summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2003-04-08 14:25:47 +0000
committerdes <des@FreeBSD.org>2003-04-08 14:25:47 +0000
commit567ac2b268739a751df819d1aa68404f430151cb (patch)
treea9d6dfe9fba9afa35e60736c6acc2bb7970ecd0a /sys/net
parente105056ea61ca6ae4a0e93115e8916181e93be8b (diff)
downloadFreeBSD-src-567ac2b268739a751df819d1aa68404f430151cb.zip
FreeBSD-src-567ac2b268739a751df819d1aa68404f430151cb.tar.gz
Introduce an M_ASSERTPKTHDR() macro which performs the very common task
of asserting that an mbuf has a packet header. Use it instead of hand- rolled versions wherever applicable. Submitted by: Hiten Pandya <hiten@unixdaemons.com>
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_disc.c3
-rw-r--r--sys/net/if_faith.c3
-rw-r--r--sys/net/if_loop.c6
3 files changed, 5 insertions, 7 deletions
diff --git a/sys/net/if_disc.c b/sys/net/if_disc.c
index 79775f1..cfc0432 100644
--- a/sys/net/if_disc.c
+++ b/sys/net/if_disc.c
@@ -155,8 +155,7 @@ static int
discoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
struct rtentry *rt)
{
- if ((m->m_flags & M_PKTHDR) == 0)
- panic("discoutput no HDR");
+ M_ASSERTPKTHDR(m);
/* BPF write needs to be handled specially */
if (dst->sa_family == AF_UNSPEC) {
dst->sa_family = *(mtod(m, int *));
diff --git a/sys/net/if_faith.c b/sys/net/if_faith.c
index 372786a..761f151 100644
--- a/sys/net/if_faith.c
+++ b/sys/net/if_faith.c
@@ -203,8 +203,7 @@ faithoutput(ifp, m, dst, rt)
{
int isr;
- if ((m->m_flags & M_PKTHDR) == 0)
- panic("faithoutput no HDR");
+ M_ASSERTPKTHDR(m);
/* BPF write needs to be handled specially */
if (dst->sa_family == AF_UNSPEC) {
diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c
index 92add8a..09ba6a3 100644
--- a/sys/net/if_loop.c
+++ b/sys/net/if_loop.c
@@ -192,8 +192,8 @@ looutput(ifp, m, dst, rt)
struct sockaddr *dst;
register struct rtentry *rt;
{
- if ((m->m_flags & M_PKTHDR) == 0)
- panic("looutput no HDR");
+
+ M_ASSERTPKTHDR(m); /* check if we have the packet header */
if (rt && rt->rt_flags & (RTF_REJECT|RTF_BLACKHOLE)) {
m_freem(m);
@@ -276,7 +276,7 @@ if_simloop(ifp, m, af, hlen)
{
int isr;
- KASSERT((m->m_flags & M_PKTHDR) != 0, ("if_simloop: no HDR"));
+ M_ASSERTPKTHDR(m);
m->m_pkthdr.rcvif = ifp;
/* BPF write needs to be handled specially */
OpenPOWER on IntegriCloud