diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/ethernet.h | 38 | ||||
-rw-r--r-- | sys/net/if_ethersubr.c | 9 | ||||
-rw-r--r-- | sys/net/if_vlan.c | 4 |
3 files changed, 20 insertions, 31 deletions
diff --git a/sys/net/ethernet.h b/sys/net/ethernet.h index ca6325a..826363d 100644 --- a/sys/net/ethernet.h +++ b/sys/net/ethernet.h @@ -102,36 +102,16 @@ extern void (*ng_ether_detach_p)(struct ifnet *ifp); extern int (*vlan_input_p)(struct ether_header *eh, struct mbuf *m); extern int (*vlan_input_tag_p)(struct ether_header *eh, struct mbuf *m, u_int16_t t); -#define _VLAN_INPUT(eh, m) do { \ - if (vlan_input_p != NULL) { \ - if ((*vlan_input_p)(eh, m) == -1) \ - (m)->m_pkthdr.rcvif->if_noproto++; \ - } else { \ - m_free(m); \ - (m)->m_pkthdr.rcvif->if_noproto++; \ - } \ -} while (0) - -#define VLAN_INPUT(eh, m) do { \ - /* XXX: lock */ \ - _VLAN_INPUT(eh, m); \ - /* XXX: unlock */ \ -} while (0) - -#define _VLAN_INPUT_TAG(eh, m, t) do { \ - if (vlan_input_tag_p != NULL) { \ - if ((*vlan_input_tag_p)(eh, m, t) == -1) \ - (m)->m_pkthdr.rcvif->if_noproto++; \ - } else { \ - m_free(m); \ - (m)->m_pkthdr.rcvif->if_noproto++; \ - } \ -} while (0) -#define VLAN_INPUT_TAG(eh, m, t) do { \ - /* XXX: lock */ \ - _VLAN_INPUT_TAG(eh, m, t); \ - /* XXX: unlock */ \ +#define VLAN_INPUT_TAG(eh, m, t) do { \ + /* XXX: lock */ \ + if (vlan_input_tag_p != NULL) \ + (*vlan_input_tag_p)(eh, m, t); \ + else { \ + (m)->m_pkthdr.rcvif->if_noproto++; \ + m_freem(m); \ + } \ + /* XXX: unlock */ \ } while (0) #else /* _KERNEL */ diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index c6e69ed..cc8ee89 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -585,7 +585,14 @@ ether_demux(ifp, eh, m) return; #endif /* NETATALK */ case ETHERTYPE_VLAN: - VLAN_INPUT(eh, m); + /* XXX lock ? */ + if (vlan_input_p != NULL) + (*vlan_input_p)(eh, m); + else { + m->m_pkthdr.rcvif->if_noproto++; + m_freem(m); + } + /* XXX unlock ? */ return; default: #ifdef IPX diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 2d142d7..d3bbdd8 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -389,7 +389,8 @@ vlan_input_tag(struct ether_header *eh, struct mbuf *m, u_int16_t t) } if (ifv == NULL || (ifv->ifv_if.if_flags & IFF_UP) == 0) { - m_free(m); + m->m_pkthdr.rcvif->if_noproto++; + m_freem(m); return -1; /* So the parent can take note */ } @@ -419,6 +420,7 @@ vlan_input(struct ether_header *eh, struct mbuf *m) } if (ifv == NULL || (ifv->ifv_if.if_flags & IFF_UP) == 0) { + m->m_pkthdr.rcvif->if_noproto++; m_freem(m); return -1; /* so ether_input can take note */ } |