aboutsummaryrefslogtreecommitdiff
path: root/contrib/ipfilter
diff options
context:
space:
mode:
authorDarren Reed <darrenr@FreeBSD.org>2000-08-13 05:00:44 +0000
committerDarren Reed <darrenr@FreeBSD.org>2000-08-13 05:00:44 +0000
commit561e006b67c19d7ac5b946b99bd76262bc85b705 (patch)
tree86db9d694442301648a084ed64580460c8128780 /contrib/ipfilter
parent3002dee91188c4b17f129c45c4a23db55d93fff5 (diff)
downloadsrc-561e006b67c19d7ac5b946b99bd76262bc85b705.tar.gz
src-561e006b67c19d7ac5b946b99bd76262bc85b705.zip
resolve conflicts
Notes
Notes: svn path=/head/; revision=64591
Diffstat (limited to 'contrib/ipfilter')
-rw-r--r--contrib/ipfilter/fil.c47
-rw-r--r--contrib/ipfilter/ip_log.c2
-rw-r--r--contrib/ipfilter/iplang/iplang_y.y3
-rw-r--r--contrib/ipfilter/ipmon.c62
4 files changed, 83 insertions, 31 deletions
diff --git a/contrib/ipfilter/fil.c b/contrib/ipfilter/fil.c
index 43a03e1db169..d34c7b077d9a 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 0a818ce43bd1..a7d1529df29e 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 28093643ccb6..aa13e8f63262 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 738ce0d80ef6..9b645da7e064 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));