Wrong outgoing interface with multiple routing tables

Oleg Sharoyko os at sfedu.ru
Tue Jul 28 13:38:19 UTC 2009


On Mon, 2009-07-27 at 16:24 -0700, Julian Elischer wrote:

> > in addition to the patches already sent you might like to add the 
> > following line to netinet/tcp_input.c
> > 
> >                 }
> >                 inc.inc_fport = th->th_sport;
> >                 inc.inc_lport = th->th_dport;
> >                 inc.inc_fibnum = so->so_fibnum; <-------------
> >                 /*
> >                  * Check for an existing connection attempt in syncache if
> >                  * the flag is only ACK.  A successful lookup creates a new
> >                  * socket appended to the listen queue in SYN_RECEIVED 
> > state.
> >                  */
> 
> in fact you might try just this on its own

With this patch alone all the packets but SYN+ACK are being sent out
correctly. SYN+ACK still uses wrong interface.

ip_output() uses struct inpcb *inp argument to set fib. But when
syncache_respond() sends SYN+ACK, ip_output() is being called without
inp (from netinet/tcp_syncache.c, syncache_respond()):

 error = ip_output(m, sc->sc_ipopts, NULL, 0, NULL, NULL);

It I add
 M_SETFIB(m, sc->sc_inc.inc_fibnum);

before the call to ip_output(), then SYN+ACK goes the right way.

-- 
Oleg Sharoyko.
Software and Network Engineer
Computer Center of Rostov State University.



More information about the freebsd-net mailing list