Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Apr 2013 01:40:55 +0000
From:      "Li, Qing" <qing.li@bluecoat.com>
To:        Juan Mojica <jmojica@gmail.com>, FreeBSD Net <freebsd-net@freebsd.org>
Cc:        "qingli@freebsd.org" <qingli@freebsd.org>
Subject:   RE: in_lltable_rtcheck
Message-ID:  <B143A8975061C446AD5E29742C531723355A0C82@pwsvl-excmbx-04.internal.cacheflow.com>
In-Reply-To: <CAPKuH-yfJf0EMyz1iEQ%2BkMz%2BenxRrfhDcpOcMJQfLjJYx10jRQ@mail.gmail.com>
References:  <CAPKuH-yfJf0EMyz1iEQ%2BkMz%2BenxRrfhDcpOcMJQfLjJYx10jRQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
The problem you described here seemed familiar so I checked into the svn hi=
story,=0A=
and found I have in fact fixed this issue in other parts of the code.=0A=
=0A=
Please see =0A=
http://svnweb.freebsd.org/base?view=3Drevision&revision=3D186708=0A=
=0A=
So I think similar fix should be applied here as well.=0A=
=0A=
--Qing=0A=
=0A=
=0A=
________________________________________=0A=
From: owner-freebsd-net@freebsd.org [owner-freebsd-net@freebsd.org] on beha=
lf of Juan Mojica [jmojica@gmail.com]=0A=
Sent: Monday, April 29, 2013 6:17 PM=0A=
To: FreeBSD Net=0A=
Subject: in_lltable_rtcheck=0A=
=0A=
Why is the code comparing the entire sockaddr structure instead of just the=
=0A=
relevant fields?  We have a flood of the log message below when=0A=
transitioning an IP address from one port to another.  And this triggers=0A=
other behavior as well.=0A=
=0A=
Through GDB, we can see that the addresses are in the same subnet.  The=0A=
problem is that the sin_port port fields in the l3addr and in sa do not=0A=
match.=0A=
=0A=
Is there a reason sin_port should be compared here?=0A=
=0A=
I can come up with a patch, that's not an issue, but I wanted to confirm=0A=
with others first.=0A=
=0A=
=0A=
        if (!(rt->rt_flags & RTF_HOST) && rt->rt_ifp !=3D ifp) {=0A=
                const char *sa, *mask, *addr, *lim;=0A=
                int len;=0A=
=0A=
                mask =3D (const char *)rt_mask(rt);=0A=
                /*=0A=
                 * Just being extra cautious to avoid some custom=0A=
                 * code getting into trouble.=0A=
                 */=0A=
                if (mask =3D=3D NULL) {=0A=
                        RTFREE_LOCKED(rt);=0A=
                        return (EINVAL);=0A=
                }=0A=
=0A=
                sa =3D (const char *)rt_key(rt);=0A=
                addr =3D (const char *)l3addr;=0A=
                len =3D ((const struct sockaddr_in *)l3addr)->sin_len;=0A=
                lim =3D addr + len;=0A=
=0A=
                for ( ; addr < lim; sa++, mask++, addr++) {=0A=
                        if ((*sa ^ *addr) & *mask) {=0A=
#ifdef DIAGNOSTIC=0A=
                                log(LOG_INFO, "IPv4 address: \"%s\" is not =
on the network\n",=0A=
                                    inet_ntoa(((const struct sockaddr_in *)=
l3addr)->sin_addr));=0A=
#endif=0A=
                                RTFREE_LOCKED(rt);=0A=
                                return (EINVAL);=0A=
                        }=0A=
                }=0A=
        }=0A=
=0A=
=0A=
Regards=0A=
=0A=
--=0A=
Juan Mojica=0A=
Email: jmojica@gmail.com=0A=
_______________________________________________=0A=
freebsd-net@freebsd.org mailing list=0A=
http://lists.freebsd.org/mailman/listinfo/freebsd-net=0A=
To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"=0A=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B143A8975061C446AD5E29742C531723355A0C82>