Changeset 482787f


Ignore:
Timestamp:
Jul 26, 2013 10:39:35 PM (7 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
767ef8c
Parents:
b2d72f9
Message:
  • Transports:
    • Really fix IPv6-only option
    • Treat RFC 4193 addresses fc00::/7 as local
    • Log tweaks, javadocs
Location:
router/java/src/net/i2p/router
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/RouterVersion.java

    rb2d72f9 r482787f  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 11;
     21    public final static long BUILD = 12;
    2222
    2323    /** for example "-test" */
  • router/java/src/net/i2p/router/transport/Transport.java

    rb2d72f9 r482787f  
    2020
    2121/**
    22  * Defines a way to send a message to another peer and start listening for messages
     22 * Defines a way to send a message to another peer and start listening for messages.
     23 *
     24 * To implement a new or pluggable I2P transport, implement this interface,
     25 * and add it to TransportManager.startListening().
    2326 *
    2427 */
     
    117120    public void setListener(TransportEventListener listener);
    118121
     122    /** The unique identity of this Transport */
    119123    public String getStyle();
    120124   
     
    130134    public short getReachabilityStatus();
    131135    public void recheckReachability();
    132     public boolean isBacklogged(Hash dest);
     136    public boolean isBacklogged(Hash peer);
    133137
    134138    /**
     
    136140     * This is NOT reset if the peer contacts us and it is never expired.
    137141     */
    138     public boolean wasUnreachable(Hash dest);
     142    public boolean wasUnreachable(Hash peer);
    139143   
    140144    public boolean isUnreachable(Hash peer);
  • router/java/src/net/i2p/router/transport/TransportImpl.java

    rb2d72f9 r482787f  
    342342        if (allTime > 5*1000) {
    343343            if (_log.shouldLog(Log.INFO))
    344                 _log.info("Took too long from preperation to afterSend(ok? " + sendSuccessful
     344                _log.info("Took too long from preparation to afterSend(ok? " + sendSuccessful
    345345                          + "): " + allTime + "ms/" + sendTime + "ms after failing on: "
    346346                          + msg.getFailedTransports() + " and succeeding on " + getStyle());
     
    605605              case IPV6_ONLY:
    606606                adj = -10;
    607                 // IPv4 addresses not rejected in isPubliclyRoutable()
     607              /**** IPv6 addresses will be rejected in isPubliclyRoutable()
    608608                for (Iterator<RouterAddress> iter = rv.iterator(); iter.hasNext(); ) {
    609609                    byte[] ip = iter.next().getIP();
     
    611611                        iter.remove();
    612612                }
     613               ****/
    613614                break;
    614615        }
     
    825826     */
    826827    protected boolean isPubliclyRoutable(byte addr[]) {
     828        TransportUtil.IPv6Config cfg = getIPv6Config();
    827829        return TransportUtil.isPubliclyRoutable(addr,
    828                                                 getIPv6Config() != TransportUtil.IPv6Config.IPV6_DISABLED);
     830                                                cfg != TransportUtil.IPv6Config.IPV6_ONLY,
     831                                                cfg != TransportUtil.IPv6Config.IPV6_DISABLED);
    829832    }
    830833
  • router/java/src/net/i2p/router/transport/TransportUtil.java

    rb2d72f9 r482787f  
    9999     */
    100100    public static boolean isPubliclyRoutable(byte addr[], boolean allowIPv6) {
     101        return isPubliclyRoutable(addr, true, allowIPv6);
     102    }
     103
     104    /**
     105     *  @param addr non-null
     106     *  @since IPv6
     107     */
     108    public static boolean isPubliclyRoutable(byte addr[], boolean allowIPv4, boolean allowIPv6) {
    101109        if (addr.length == 4) {
     110            if (!allowIPv4)
     111                return false;
    102112            int a0 = addr[0] & 0xFF;
    103113            if (a0 == 127) return false;
     
    117127                if (addr[0] == 0x20 && addr[1] == 0x02)
    118128                    return false;
     129                // disallow fc00::/8 and fd00::/8 (Unique local addresses RFC 4193)
     130                // not recognized as local by InetAddress
     131                if ((addr[0] & 0xfe) == 0xfc)
     132                    return false;
    119133                try {
    120134                    InetAddress ia = InetAddress.getByAddress(addr);
  • router/java/src/net/i2p/router/transport/udp/PacketBuilder.java

    rb2d72f9 r482787f  
    673673        }
    674674        if (_log.shouldLog(Log.DEBUG))
    675             _log.debug("Sending request");
     675            _log.debug("Sending request to " + Addresses.toString(toIP));
    676676       
    677677        // now for the body
  • router/java/src/net/i2p/router/transport/udp/UDPTransport.java

    rb2d72f9 r482787f  
    15631563                    continue;
    15641564                }
     1565            } else {
     1566                // introducers
     1567                if (getIPv6Config() == IPV6_ONLY)
     1568                    continue;
    15651569            }
    15661570            return addr;
     
    20572061        if (msg == null) return;
    20582062        if (_log.shouldLog(Log.INFO))
    2059             _log.info("Sending message failed: " + msg, new Exception("failed from"));
     2063            _log.info("Send failed: " + reason + " msg: " + msg, new Exception("failed from"));
    20602064       
    20612065        if (_context.messageHistory().getDoLog())
Note: See TracChangeset for help on using the changeset viewer.