diff options
author | darrenr <darrenr@FreeBSD.org> | 2000-08-13 05:00:44 +0000 |
---|---|---|
committer | darrenr <darrenr@FreeBSD.org> | 2000-08-13 05:00:44 +0000 |
commit | 100a11733cd237ac838ef096cde71c7a8b20be82 (patch) | |
tree | 1b94a958495c7e0493a46b7b0310c343b6cfda20 /contrib | |
parent | 8a085613071c599a6d5b98efa2b89b1573c97563 (diff) | |
download | FreeBSD-src-100a11733cd237ac838ef096cde71c7a8b20be82.zip FreeBSD-src-100a11733cd237ac838ef096cde71c7a8b20be82.tar.gz |
resolve conflicts
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/ipfilter/fil.c | 47 | ||||
-rw-r--r-- | contrib/ipfilter/ip_log.c | 2 | ||||
-rw-r--r-- | contrib/ipfilter/iplang/iplang_y.y | 3 | ||||
-rw-r--r-- | contrib/ipfilter/ipmon.c | 62 |
4 files changed, 83 insertions, 31 deletions
diff --git a/contrib/ipfilter/fil.c b/contrib/ipfilter/fil.c index 43a03e1..d34c7b0 100644 --- a/contrib/ipfilter/fil.c +++ b/contrib/ipfilter/fil.c @@ -820,18 +820,6 @@ int out; fin->fin_qfm = m; fin->fin_qif = qif; # endif -# ifdef USE_INET6 - if (v == 6) { - ATOMIC_INCL(frstats[0].fr_ipv6[out]); - } else -# endif - if (!out && fr_chksrc && !fr_verifysrc(ip->ip_src, ifp)) { - ATOMIC_INCL(frstats[0].fr_badsrc); -# if !SOLARIS - m_freem(m); -# endif - return error; - } #endif /* _KERNEL */ /* @@ -847,8 +835,29 @@ int out; fin->fin_out = out; fin->fin_mp = mp; fr_makefrip(hlen, ip, fin); - pass = fr_pass; +#ifdef _KERNEL +# ifdef USE_INET6 + if (v == 6) { + ATOMIC_INCL(frstats[0].fr_ipv6[out]); + } else +# endif + if (!out && fr_chksrc && !fr_verifysrc(ip->ip_src, ifp)) { + ATOMIC_INCL(frstats[0].fr_badsrc); +# ifdef IPFILTER_LOG + if (fr_chksrc == 2) { + fin->fin_group = -2; + pass = FR_INQUE|FR_NOMATCH|FR_LOGB; + (void) IPLLOG(pass, ip, fin, m); + } +# endif +# if !SOLARIS + m_freem(m); +# endif + return error; + } +#endif + pass = fr_pass; if (fin->fin_fi.fi_fl & FI_SHORT) { ATOMIC_INCL(frstats[out].fr_short); } @@ -1367,7 +1376,7 @@ nodata: * SUCH DAMAGE. * * @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94 - * $Id: fil.c,v 2.35.2.18 2000/07/19 13:13:40 darrenr Exp $ + * $Id: fil.c,v 2.35.2.20 2000/08/13 04:15:43 darrenr Exp $ */ /* * Copy data from an mbuf chain starting "off" bytes from the beginning, @@ -1846,11 +1855,14 @@ size_t c; int err; #if SOLARIS - copyin(a, &ca, sizeof(ca)); + if (copyin(a, &ca, sizeof(ca))) + return EFAULT; #else bcopy(a, &ca, sizeof(ca)); #endif err = copyin(ca, b, c); + if (err) + err = EFAULT; return err; } @@ -1863,11 +1875,14 @@ size_t c; int err; #if SOLARIS - copyin(b, &ca, sizeof(ca)); + if (copyin(b, &ca, sizeof(ca))) + return EFAULT; #else bcopy(b, &ca, sizeof(ca)); #endif err = copyout(a, ca, c); + if (err) + err = EFAULT; return err; } diff --git a/contrib/ipfilter/ip_log.c b/contrib/ipfilter/ip_log.c index 0a818ce..a7d1529 100644 --- a/contrib/ipfilter/ip_log.c +++ b/contrib/ipfilter/ip_log.c @@ -22,8 +22,6 @@ # endif # else # ifdef KLD_MODULE -# include <sys/osreldate.h> -# else # include <osreldate.h> # endif # endif diff --git a/contrib/ipfilter/iplang/iplang_y.y b/contrib/ipfilter/iplang/iplang_y.y index 2809364..aa13e8f 100644 --- a/contrib/ipfilter/iplang/iplang_y.y +++ b/contrib/ipfilter/iplang/iplang_y.y @@ -49,7 +49,8 @@ #include "ipf.h" #include "iplang.h" -#if !defined(__NetBSD__) && !defined(__FreeBSD__) +#if !defined(__NetBSD__) && (!defined(__FreeBSD_version) && \ + __FreeBSD_version < 400020) extern struct ether_addr *ether_aton __P((char *)); #endif diff --git a/contrib/ipfilter/ipmon.c b/contrib/ipfilter/ipmon.c index 738ce0d..9b645da 100644 --- a/contrib/ipfilter/ipmon.c +++ b/contrib/ipfilter/ipmon.c @@ -336,7 +336,7 @@ int len; t += 2; if (!((j + 1) & 0xf)) { s -= 15; - sprintf((char *)t, " "); + sprintf((char *)t, " "); t += 8; for (k = 16; k; k--, s++) *t++ = (isprint(*s) ? *s : '.'); @@ -581,6 +581,7 @@ int blen; { tcphdr_t *tp; struct icmp *ic; + struct icmp *icmp; struct tm *tm; char *t, *proto; int i, v, lvl, res, len, off, plen, ipoff; @@ -742,19 +743,56 @@ int blen; ic->icmp_type == ICMP_REDIRECT || ic->icmp_type == ICMP_TIMXCEED) { ipc = &ic->icmp_ip; - tp = (tcphdr_t *)((char *)ipc + hl); - + i = ntohs(ipc->ip_len); + ipoff = ntohs(ipc->ip_off); proto = getproto(ipc->ip_p); - t += strlen(t); - (void) sprintf(t, " for %s,%s -", - HOSTNAME_V4(res, ipc->ip_src), - portname(res, proto, (u_int)tp->th_sport)); - t += strlen(t); - (void) sprintf(t, " %s,%s PR %s len %hu %hu", - HOSTNAME_V4(res, ipc->ip_dst), - portname(res, proto, (u_int)tp->th_dport), - proto, ipc->ip_hl << 2, ipc->ip_len); + if (!(ipoff & IP_OFFMASK) && + ((ipc->ip_p == IPPROTO_TCP) || + (ipc->ip_p == IPPROTO_UDP))) { + tp = (tcphdr_t *)((char *)ipc + hl); + t += strlen(t); + (void) sprintf(t, " for %s,%s -", + HOSTNAME_V4(res, ipc->ip_src), + portname(res, proto, + (u_int)tp->th_sport)); + t += strlen(t); + (void) sprintf(t, " %s,%s PR %s len %hu %hu", + HOSTNAME_V4(res, ipc->ip_dst), + portname(res, proto, + (u_int)tp->th_dport), + proto, ipc->ip_hl << 2, i); + } else if (!(ipoff & IP_OFFMASK) && + (ipc->ip_p == IPPROTO_ICMP)) { + icmp = (icmphdr_t *)((char *)ipc + hl); + + t += strlen(t); + (void) sprintf(t, " for %s -", + HOSTNAME_V4(res, ipc->ip_src)); + t += strlen(t); + (void) sprintf(t, + " %s PR icmp len %hu %hu icmp %d/%d", + HOSTNAME_V4(res, ipc->ip_dst), + ipc->ip_hl << 2, i, + icmp->icmp_type, icmp->icmp_code); + + } else { + t += strlen(t); + (void) sprintf(t, " for %s -", + HOSTNAME_V4(res, ipc->ip_src)); + t += strlen(t); + (void) sprintf(t, " %s PR %s len %hu (%hu)", + HOSTNAME_V4(res, ipc->ip_dst), proto, + ipc->ip_hl << 2, i); + t += strlen(t); + if (ipoff & IP_OFFMASK) { + (void) sprintf(t, " frag %s%s%hu@%hu", + ipoff & IP_MF ? "+" : "", + ipoff & IP_DF ? "-" : "", + i - (ipc->ip_hl<<2), + (ipoff & IP_OFFMASK) << 3); + } + } } } else { (void) sprintf(t, "%s -> ", hostname(res, v, s)); |