Date: Sun, 30 Mar 2014 16:45:33 -0400 From: Patrick Kelsey <kelsey@ieee.org> To: freebsd-net@freebsd.org Subject: Extraneous code in syncache_socket() Message-ID: <CAD44qMUQDoFOwWHNkhUxre3GhTwxrP-gNxzBcRX0sOQzkV1ewA@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAD44qMUQDoFOwWHNkhUxre3GhTwxrP-gNxzBcRX0sOQzkV1ewA>