diff options
| author | Andrew R. Reiter <arr@FreeBSD.org> | 2002-05-21 18:52:24 +0000 |
|---|---|---|
| committer | Andrew R. Reiter <arr@FreeBSD.org> | 2002-05-21 18:52:24 +0000 |
| commit | db40007d42fa5f449ed312499635957a39a21d03 (patch) | |
| tree | 3a864b73f84ee96f800b6e857658551c76ef181c /sys | |
| parent | 720bbc82448654b1407058ae6b3ffd7fd9acfd44 (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/netinet/if_atm.c | 7 | ||||
| -rw-r--r-- | sys/netinet/ip_input.c | 7 | ||||
| -rw-r--r-- | sys/netinet/ip_output.c | 26 |
3 files changed, 16 insertions, 24 deletions
diff --git a/sys/netinet/if_atm.c b/sys/netinet/if_atm.c index acad219d008e6..934309b7761be 100644 --- a/sys/netinet/if_atm.c +++ b/sys/netinet/if_atm.c @@ -125,11 +125,8 @@ atm_rtrequest(req, rt, info) break; } -#ifdef INVARIANTS - if (rt->rt_ifp->if_ioctl == NULL) - panic("atm_rtrequest: atm null ioctl"); -#endif - + KASSERT(rt->rt_ifp->if_ioctl != NULL, + ("atm_rtrequest: null ioctl")); #ifdef NATM /* * let native ATM know we are using this VCI/VPI diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index f0cf8fa4f5dfb..b33bc5bdf36fc 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -309,10 +309,9 @@ ip_input(struct mbuf *m) } else rule = NULL ; -#ifdef INVARIANTS - if (m == NULL || (m->m_flags & M_PKTHDR) == 0) - panic("ip_input no HDR"); -#endif + KASSERT(m != NULL && (m->m_flags & M_PKTHDR) != 0, + ("ip_input: no HDR")); + ipstat.ips_total++; if (m->m_pkthdr.len < sizeof(struct ip)) diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 818bd944e7888..f553872e65411 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -186,13 +186,11 @@ ip_output(m0, opt, ro, flags, imo) (void)ipsec_setsocket(m, NULL); #endif -#ifdef INVARIANTS - if ((m->m_flags & M_PKTHDR) == 0) - panic("ip_output no HDR"); - if (!ro) - panic("ip_output no route, proto = %d", - mtod(m, struct ip *)->ip_p); -#endif + KASSERT((m->m_flags & M_PKTHDR) != 0, ("ip_output: no HDR")); + + KASSERT(ro != NULL, ("ip_output: no route, proto %d", + mtod(m, struct ip *)->ip_p)); + if (opt) { m = ip_insertoptions(m, opt, &len); hlen = len; @@ -1111,15 +1109,13 @@ ip_optcopy(ip, jp) optlen = 1; continue; } -#ifdef INVARIANTS - if (cnt < IPOPT_OLEN + sizeof(*cp)) - panic("malformed IPv4 option passed to ip_optcopy"); -#endif + + KASSERT(cnt >= IPOPT_OLEN + sizeof(*cp), + ("ip_optcopy: malformed ipv4 option")); optlen = cp[IPOPT_OLEN]; -#ifdef INVARIANTS - if (optlen < IPOPT_OLEN + sizeof(*cp) || optlen > cnt) - panic("malformed IPv4 option passed to ip_optcopy"); -#endif + KASSERT(optlen >= IPOPT_OLEN + sizeof(*cp) && optlen <= cnt, + ("ip_optcopy: malformed ipv4 option")); + /* bogus lengths should have been caught by ip_dooptions */ if (optlen > cnt) optlen = cnt; |
