diff options
author | Kjell Wooding <kjell@cvs.openbsd.org> | 2001-01-30 04:26:03 +0000 |
---|---|---|
committer | Kjell Wooding <kjell@cvs.openbsd.org> | 2001-01-30 04:26:03 +0000 |
commit | 3b92d24a6aca02b8fc77a0d881343191f7728c09 (patch) | |
tree | 64f27190a460c683c145a3d42e24b68e2f58d9e6 /sbin/ipf/common.c | |
parent | 2f35ed6fbb48972a399c5b56df252d3edcf73809 (diff) |
reimplement local ipf mods and import some missed patches
Diffstat (limited to 'sbin/ipf/common.c')
-rw-r--r-- | sbin/ipf/common.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/sbin/ipf/common.c b/sbin/ipf/common.c index 569d6e0427f..edea2441d88 100644 --- a/sbin/ipf/common.c +++ b/sbin/ipf/common.c @@ -1,4 +1,4 @@ -/* $OpenBSD: common.c,v 1.1 2001/01/17 05:00:57 fgsch Exp $ */ +/* $OpenBSD: common.c,v 1.2 2001/01/30 04:26:01 kjell Exp $ */ /* * Copyright (C) 1993-2000 by Darren Reed. @@ -36,15 +36,11 @@ #include <resolv.h> #include <ctype.h> #include <syslog.h> -#include <netinet/ip_compat.h> +#include <netinet/ip_fil_compat.h> #include <netinet/ip_fil.h> #include "ipf.h" #include "facpri.h" -#if defined(__OpenBSD__) -#include "ifaddr.h" -#endif - #if !defined(lint) static const char sccsid[] = "@(#)parse.c 1.44 6/5/96 (C) 1993-2000 Darren Reed"; static const char rcsid[] = "@(#)$IPFilter: parse.c,v 2.8 1999/12/28 10:49:46 darrenr Exp $"; @@ -55,11 +51,16 @@ extern int opts; #ifdef USE_INET6 extern int use_inet6; #endif +#if defined(__OpenBSD__) +extern int if_addr __P((char *, struct in_addr *)); +#endif + char *proto = NULL; -char flagset[] = "FSRPAU"; -u_char flags[] = { TH_FIN, TH_SYN, TH_RST, TH_PUSH, TH_ACK, TH_URG }; +char flagset[] = "FSRPAUEC"; +u_char flags[] = { TH_FIN, TH_SYN, TH_RST, TH_PUSH, TH_ACK, TH_URG, + TH_ECN, TH_CWR }; #ifdef USE_INET6 void fill6bits __P((int, u_32_t *)); @@ -72,7 +73,6 @@ static char thishost[MAXHOSTNAMELEN]; void initparse() { gethostname(thishost, sizeof(thishost)); - thishost[sizeof(thishost) - 1] = '\0'; } @@ -252,8 +252,11 @@ int linenum; host = thishost; #if defined(__OpenBSD__) - if (if_addr(host, &ip)) - return *ipa = ip.s_addr; + /* attempt a map from interface name to address */ + if (if_addr(host, &ip)) { + *ipa = ip.s_addr; + return 0; + } #endif if (!(hp = gethostbyname(host))) { @@ -420,8 +423,12 @@ int linenum; if (s && *s == '0') tcpfm = strtol(s, NULL, 0); - if (!tcpfm) - tcpfm = 0xff; + if (!tcpfm) { + if (tcpf == TH_SYN) + tcpfm = 0xff & ~(TH_ECN|TH_CWR); + else + tcpfm = 0xff & ~(TH_ECN); + } *mask = tcpfm; return tcpf; } |