Extraneous code in syncache_socket()
Patrick Kelsey
kelsey at ieee.org
Sun Mar 30 20:45:36 UTC 2014
Using sys/netinet/tcp_syncache.c in r261594 for reference (
http://svnweb.freebsd.org/base/head/sys/netinet/tcp_syncache.c?view=markup),
I believe the following code in syncache_socket() serves no purpose:
These two lines beginning at line 780:
if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr))
inp->in6p_laddr = sc->sc_inc.inc6_laddr;
and these two lines beginning at line 820:
if (inp->inp_laddr.s_addr == INADDR_ANY)
inp->inp_laddr = sc->sc_inc.inc_laddr;
In the cases where the above lines are reached, the same assignments have
already been performed by the if/else block starting at line 702. The only
intervening code path that I see that modifies inp->in6p_laddr or
inp->inp_laddr exits the routine, via the goto abort; statement at line
748, before reaching the above lines. Thus, conditionally performing these
assignments again serves no apparent purpose.
-Patrick
More information about the freebsd-net
mailing list