From owner-freebsd-net@FreeBSD.ORG Tue Apr 30 01:17:33 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 130C14CA for ; Tue, 30 Apr 2013 01:17:33 +0000 (UTC) (envelope-from jmojica@gmail.com) Received: from mail-we0-x231.google.com (mail-we0-x231.google.com [IPv6:2a00:1450:400c:c03::231]) by mx1.freebsd.org (Postfix) with ESMTP id 901FC11F6 for ; Tue, 30 Apr 2013 01:17:32 +0000 (UTC) Received: by mail-we0-f177.google.com with SMTP id s47so3661wey.22 for ; Mon, 29 Apr 2013 18:17:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=bQ3/2h++Beo8WD7daUIJk4sueQfs0F9PS5SVafpv+NE=; b=Pxzudpf4JesjMLuFJJJxn+qz7i2Cfcp2ZgZkzSLHpKjFliWSi+YP7qzHAzDFl8OOTC ktQWsH/UGirFOMpFmcj9QmJldrRJ6jt6JCIForWGViFvWWY0z5hKtlNDojs8mcAzMjnx KMmZnT/Mwi5FP/wgeEEUbTYEC/XIFtZOyC4ZgVzbC5JSx0XKb7JVfO2qZwEUVjFfA5HP /XnncqwQr5vOZBUMiusyxmcjSjPDQudyuoK8QBiVtp5UCwU0Aw31Ov8YhdjUAOy//Bxh CNPVUE7xs+lJFxQCh2GbrgM2Y/nchSd1tj8RCqR8yDDnOpYL6/vbRRcZYw9xcGtWvrpn kuUQ== MIME-Version: 1.0 X-Received: by 10.180.24.69 with SMTP id s5mr21211417wif.34.1367284651074; Mon, 29 Apr 2013 18:17:31 -0700 (PDT) Received: by 10.194.82.138 with HTTP; Mon, 29 Apr 2013 18:17:30 -0700 (PDT) Date: Mon, 29 Apr 2013 21:17:30 -0400 Message-ID: Subject: in_lltable_rtcheck From: Juan Mojica To: FreeBSD Net Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Apr 2013 01:17:33 -0000 Why is the code comparing the entire sockaddr structure instead of just the relevant fields? We have a flood of the log message below when transitioning an IP address from one port to another. And this triggers other behavior as well. Through GDB, we can see that the addresses are in the same subnet. The problem is that the sin_port port fields in the l3addr and in sa do not match. Is there a reason sin_port should be compared here? I can come up with a patch, that's not an issue, but I wanted to confirm with others first. if (!(rt->rt_flags & RTF_HOST) && rt->rt_ifp != ifp) { const char *sa, *mask, *addr, *lim; int len; mask = (const char *)rt_mask(rt); /* * Just being extra cautious to avoid some custom * code getting into trouble. */ if (mask == NULL) { RTFREE_LOCKED(rt); return (EINVAL); } sa = (const char *)rt_key(rt); addr = (const char *)l3addr; len = ((const struct sockaddr_in *)l3addr)->sin_len; lim = addr + len; for ( ; addr < lim; sa++, mask++, addr++) { if ((*sa ^ *addr) & *mask) { #ifdef DIAGNOSTIC log(LOG_INFO, "IPv4 address: \"%s\" is not on the network\n", inet_ntoa(((const struct sockaddr_in *)l3addr)->sin_addr)); #endif RTFREE_LOCKED(rt); return (EINVAL); } } } Regards -- Juan Mojica Email: jmojica@gmail.com