From owner-freebsd-net@FreeBSD.ORG Sun Mar 30 20:45:36 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 592C8AC3 for ; Sun, 30 Mar 2014 20:45:36 +0000 (UTC) Received: from mail-la0-x235.google.com (mail-la0-x235.google.com [IPv6:2a00:1450:4010:c03::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D896098C for ; Sun, 30 Mar 2014 20:45:35 +0000 (UTC) Received: by mail-la0-f53.google.com with SMTP id b8so5262467lan.12 for ; Sun, 30 Mar 2014 13:45:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=qX1lBqnSOsamRfA5xh23dJp1tTFvQF8vf8bnUxPSId0=; b=EvgCRgoOPnDNu4sO/ALPQZHH/dm/YaDZPeEkJ8wiS+StKOXjvOL9/fi5oofaszbaJj SwjV4T05frYtf5FNEawKkk2OPVSWv84yPxx1txbSHfBhPs1Dj6BnA7emiQCle7Q7unTw h+sEoUMQXyV+FtqB6aY/w3f/uzHqeNQwnre6H0oQIR6RNk50NeBsA1lVXJKwGXiQfzzf GhYoBSM6bQBCXNY8uaR4HuyxhxvKXceXR7jGUgsZVlaaKABao/hobaVR5OO/hgpO60PN 5MTrnjkFBllLVxYhuLWrD1iH/CByrvcVu+UoGE53xXitTzLGXoMaTGFxCQ+qnR2EDQqH tm3A== MIME-Version: 1.0 X-Received: by 10.112.137.193 with SMTP id qk1mr15856lbb.53.1396212333880; Sun, 30 Mar 2014 13:45:33 -0700 (PDT) Sender: pkelsey@gmail.com Received: by 10.112.141.196 with HTTP; Sun, 30 Mar 2014 13:45:33 -0700 (PDT) Date: Sun, 30 Mar 2014 16:45:33 -0400 X-Google-Sender-Auth: GZtf3a2QnZtDFADM1yQifnPXCpM Message-ID: Subject: Extraneous code in syncache_socket() From: Patrick Kelsey To: freebsd-net@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.17 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Mar 2014 20:45:36 -0000 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