Changeset a846271 for router


Ignore:
Timestamp:
Aug 19, 2018 6:56:59 PM (23 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
96f7c15
Parents:
da476be
Message:

NTCP2: Catch bad IV exception

Location:
router/java/src/net/i2p/router
Files:
4 edited

Legend:

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

    rda476be ra846271  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 24;
     21    public final static long BUILD = 25;
    2222
    2323    /** for example "-test" */
  • router/java/src/net/i2p/router/transport/ntcp/NTCPConnection.java

    rda476be ra846271  
    243243     *
    244244     * @param version must be 1 or 2
     245     * @throws DataFormatException if there's a problem with the address
    245246     */
    246247    public NTCPConnection(RouterContext ctx, NTCPTransport transport, RouterIdentity remotePeer,
    247                           RouterAddress remAddr, int version) {
     248                          RouterAddress remAddr, int version) throws DataFormatException {
    248249        this(ctx, transport, remAddr, false);
    249250        _remotePeer = remotePeer;
    250251        _version = version;
    251         if (version == 1)
     252        if (version == 1) {
    252253            _establishState = new OutboundEstablishState(ctx, transport, this);
    253         else
    254             _establishState = new OutboundNTCP2State(ctx, transport, this);
     254        } else {
     255            try {
     256                _establishState = new OutboundNTCP2State(ctx, transport, this);
     257            } catch (IllegalArgumentException iae) {
     258                throw new DataFormatException("bad address? " + remAddr, iae);
     259            }
     260        }
    255261    }
    256262
  • router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java

    rda476be ra846271  
    3030import net.i2p.crypto.SigType;
    3131import net.i2p.data.Base64;
     32import net.i2p.data.DataFormatException;
    3233import net.i2p.data.DataHelper;
    3334import net.i2p.data.Hash;
     
    335336                        newVersion = getNTCPVersion(addr);
    336337                        if (newVersion != 0) {
    337                             con = new NTCPConnection(_context, this, ident, addr, newVersion);
    338                             establishing(con);
    339                             //if (_log.shouldLog(Log.DEBUG))
    340                             //    _log.debug("Send on a new con: " + con + " at " + addr + " for " + ih);
    341                             // Note that outbound conns go in the map BEFORE establishment
    342                             _conByIdent.put(ih, con);
     338                            try {
     339                                con = new NTCPConnection(_context, this, ident, addr, newVersion);
     340                                establishing(con);
     341                                //if (_log.shouldLog(Log.DEBUG))
     342                                //    _log.debug("Send on a new con: " + con + " at " + addr + " for " + ih);
     343                                // Note that outbound conns go in the map BEFORE establishment
     344                                _conByIdent.put(ih, con);
     345                            } catch (DataFormatException dfe) {
     346                                if (_log.shouldWarn())
     347                                    _log.warn("bad address? " + target, dfe);
     348                                fail = true;
     349                            }
    343350                        } else {
    344351                            fail = true;
  • router/java/src/net/i2p/router/transport/ntcp/OutboundNTCP2State.java

    rda476be ra846271  
    9595    }
    9696   
     97    /**
     98     * @throws IllegalArgumentException on bad address in the con
     99     */
    97100    public OutboundNTCP2State(RouterContext ctx, NTCPTransport transport, NTCPConnection con) {
    98101        _context = ctx;
Note: See TracChangeset for help on using the changeset viewer.