On Thu, Jul 02, 2015 at 03:07:37PM +0200, Martin Pieuchot wrote:
> On 02/07/15(Thu) 13:57, Sebastien Marie wrote:
> > Hi,
> > 
> > On amd64, after a system update via snapshot, I start to see warning
> > messages in console (and to be complete, the running kernel is GENERIC.MP
> > with a patch on acpitz, so shoudn't be related).
> > 
> > The message is (complete dmesg below):
> > bge0: trying to send packet on wrong domain. if 0 vs. mbuf 52
> > 
> > The network configuration is the following:
> > 
> > # cat /etc/hostname.bge0                                                    
> >                                                          
> > dhcp
> > inet6 autoconf
> > up
> > !/usr/sbin/arp -F -s 192.168.92.2 c8:be:19:e2:2c:ed permanent
> > 
> > # cat /etc/hostname.vlan52                                                  
> >                                                          
> > vlandev bge0 rdomain 52
> > description "Test"
> > inet 192.168.52.45
> > 
> > The vlan52 interface is only used for test purpose, and I use rdomain to
> > ensure separation from the rest of the system.
> > 
> > /etc/pf.conf contains nothing related to rtable or rdomain.
> > # cat /etc/pf.conf
> > # See pf.conf(5) and /etc/examples/pf.conf
> > 
> > set skip on lo
> > 
> > # enable statistic collection on egress
> > set loginterface egress
> > 
> > block return    # block stateless traffic
> > pass            # establish keep-state
> > 
> > # By default, do not permit remote connections to X11
> > block return in on ! lo0 proto tcp to port 6000:6010
> > 
> > 
> > The rtable 52 has nothing special (no manual adding).
> > 
> > # route -T 52 -n show                
> > Routing tables
> > 
> > Internet:
> > Destination        Gateway            Flags   Refs      Use   Mtu  Prio
> > Iface
> > 192.168.52/24      192.168.52.45      UC         1        0     -     8 
> > vlan52
> > 192.168.52.1       link#8             UHLc       0        1     -     8 
> > vlan52
> > 192.168.52.45      00:1b:38:33:97:b0  UHLl       0        0     -     1 lo0 
> >  
> > 192.168.52.255     192.168.52.45      UHb        0        0     -     1 
> > vlan52
> > 
> > 
> > The message is printed for every packet sent from rdomain 52
> > $ route -T 52 exec ping 192.168.52.1 
> > PING 192.168.52.1 (192.168.52.1): 56 data bytes
> > --- 192.168.52.1 ping statistics ---
> > 2 packets transmitted, 0 packets received, 100.0% packet loss
> > 
> > $ dmesg | tail -2
> > bge0: trying to send packet on wrong domain. if 0 vs. mbuf 52
> > bge0: trying to send packet on wrong domain. if 0 vs. mbuf 52
> > 
> > No other problem than a message in console for every packet.
> > 
> > This message have been introduced in sys/net/if.c (line 452) at version
> > 1.344.
> > 
> > >   if (ifp->if_rdomain != rtable_l2(m->m_pkthdr.ph_rtableid)) {
> > >                printf("%s: trying to send packet on wrong domain. "
> > >                       "if %d vs. mbuf %d\n",
> > >                       ifp->if_xname, ifp->if_rdomain,
> > >                       rtable_l2(m->m_pkthdr.ph_rtableid));
> > >   }
> > 
> > I am also able to reproduce it on other host with true GENERIC.MP (from
> > same snapshot version), with more conventional network configuration (no
> > mix between tagged/untagged vlan):
> >   - one physical re0 (just up)
> >   - several vlan interface on it
> >   - one rdomain on vlan interface
> 
> Well I made a mistake, thanks for spotting it.  Here's a revert diff:
> 
> Index: net/if.c
> ===================================================================
> RCS file: /cvs/src/sys/net/if.c,v
> retrieving revision 1.348
> diff -u -p -r1.348 if.c
> --- net/if.c  2 Jul 2015 09:40:02 -0000       1.348
> +++ net/if.c  2 Jul 2015 13:02:13 -0000
> @@ -447,14 +447,6 @@ if_enqueue(struct ifnet *ifp, struct mbu
>       int s, length, error = 0;
>       unsigned short mflags;
>  
> -#ifdef DIAGNOSTIC
> -     if (ifp->if_rdomain != rtable_l2(m->m_pkthdr.ph_rtableid)) {
> -             printf("%s: trying to send packet on wrong domain. "
> -                 "if %d vs. mbuf %d\n", ifp->if_xname, ifp->if_rdomain,
> -                 rtable_l2(m->m_pkthdr.ph_rtableid));
> -     }
> -#endif
> -
>  #if NBRIDGE > 0
>       if (ifp->if_bridgeport && (m->m_flags & M_PROTO1) == 0)
>               return (bridge_output(ifp, m, NULL, NULL));
> Index: net/if_ethersubr.c
> ===================================================================
> RCS file: /cvs/src/sys/net/if_ethersubr.c,v
> retrieving revision 1.214
> diff -u -p -r1.214 if_ethersubr.c
> --- net/if_ethersubr.c        2 Jul 2015 09:40:02 -0000       1.214
> +++ net/if_ethersubr.c        2 Jul 2015 13:05:06 -0000
> @@ -176,6 +176,14 @@ ether_output(struct ifnet *ifp, struct m
>       struct arpcom *ac = (struct arpcom *)ifp;
>       int error = 0;
>  
> +#ifdef DIAGNOSTIC
> +     if (ifp->if_rdomain != rtable_l2(m->m_pkthdr.ph_rtableid)) {
> +             printf("%s: trying to send packet on wrong domain. "
> +                 "if %d vs. mbuf %d\n", ifp->if_xname,
> +                 ifp->if_rdomain, rtable_l2(m->m_pkthdr.ph_rtableid));
> +     }
> +#endif
> +
>       esrc = ac->ac_enaddr;
>  
>       if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
> 

Yes, that is better. Rdomains are for L3 and stop at the L2 boundary so
ether_output() is the place to check. OK claudio@

-- 
:wq Claudio

Reply via email to