On Wed, Aug 19, 2015 at 02:41:22PM +0200, Martin Pieuchot wrote:
> > Diff below converts one of the few remaining iteration on the global
> > list of interfaces (&ifnet).
> /* Check for local address spoofing. */
> - if (((ifp = if_get(m->m_pkthdr.ph_ifidx)) == NULL ||
> - !(ifp->if_flags & IFF_LOOPBACK)) && ipip_allow != 2) {
If the packet was coming from a loopback interface it was always
passed. Your code always drops if it is coming from a local address.
I think we need this check, see also the comment mentioning ph_ifidx
above the function ipip_input().
> > + struct sockaddr_storage ss;
> > + struct rtentry *rt;
> > +
> > + if (ipo) {
> > + sin = (struct sockaddr_in *)&ss;
> > + sin->sin_family = AF_INET;
> > + sin->sin_len = sizeof(*sin);
> > + sin->sin_addr = ipo->ip_src;
> > +#ifdef INET6
> > + } else if (ip6) {
> > + sin6 = (struct sockaddr_in6 *)&ss;
> > + sin6->sin6_family = AF_INET6;
> > + sin6->sin6_len = sizeof(*sin6);
> > + sin6->sin6_addr = ip6->ip6_src;
> > #endif /* INET6 */
> > + }
Normaly you should memset(0) sin and sin6 because of the padding.
At least in user land and with sobind() this is necessary. Most
of the kernel code does this. But there are a few places where it
is not done before rtalloc(). I think we should initialize it
everywhere. I can build a diff to make it consistent.
bluhm