Fix a couple of incorrect m_free() vs. m_freem() usages and related issues.
Reviewed-by: brooks
This commit is contained in:
parent
61b60edfd3
commit
7d3e4c6e71
@ -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_p)(struct ether_header *eh, struct mbuf *m);
|
||||||
extern int (*vlan_input_tag_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);
|
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 { \
|
#define VLAN_INPUT_TAG(eh, m, t) do { \
|
||||||
/* XXX: lock */ \
|
/* XXX: lock */ \
|
||||||
_VLAN_INPUT(eh, m); \
|
if (vlan_input_tag_p != NULL) \
|
||||||
/* XXX: unlock */ \
|
(*vlan_input_tag_p)(eh, m, t); \
|
||||||
} while (0)
|
else { \
|
||||||
|
(m)->m_pkthdr.rcvif->if_noproto++; \
|
||||||
#define _VLAN_INPUT_TAG(eh, m, t) do { \
|
m_freem(m); \
|
||||||
if (vlan_input_tag_p != NULL) { \
|
} \
|
||||||
if ((*vlan_input_tag_p)(eh, m, t) == -1) \
|
/* XXX: unlock */ \
|
||||||
(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 */ \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#else /* _KERNEL */
|
#else /* _KERNEL */
|
||||||
|
@ -585,7 +585,14 @@ ether_demux(ifp, eh, m)
|
|||||||
return;
|
return;
|
||||||
#endif /* NETATALK */
|
#endif /* NETATALK */
|
||||||
case ETHERTYPE_VLAN:
|
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;
|
return;
|
||||||
default:
|
default:
|
||||||
#ifdef IPX
|
#ifdef IPX
|
||||||
|
@ -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) {
|
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 */
|
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) {
|
if (ifv == NULL || (ifv->ifv_if.if_flags & IFF_UP) == 0) {
|
||||||
|
m->m_pkthdr.rcvif->if_noproto++;
|
||||||
m_freem(m);
|
m_freem(m);
|
||||||
return -1; /* so ether_input can take note */
|
return -1; /* so ether_input can take note */
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user