Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/ipf/dist bring back all our fixes.
details: https://anonhg.NetBSD.org/src/rev/98faa6516b30
branches: trunk
changeset: 778390:98faa6516b30
user: christos <christos%NetBSD.org@localhost>
date: Sat Mar 24 02:19:00 2012 +0000
description:
bring back all our fixes.
diffstat:
external/bsd/ipf/dist/ip_fil.c | 31 ++++++----
external/bsd/ipf/dist/ip_scan.c | 6 +-
external/bsd/ipf/dist/ipsend/ip.c | 6 +-
external/bsd/ipf/dist/ipsend/iptest.1 | 6 +-
external/bsd/ipf/dist/lib/load_http.c | 42 ++++++++++----
external/bsd/ipf/dist/lib/printactivenat.c | 6 +-
external/bsd/ipf/dist/man/ipf.4 | 13 ++++-
external/bsd/ipf/dist/man/ipf.5 | 18 +++---
external/bsd/ipf/dist/man/ipfstat.8 | 6 +-
external/bsd/ipf/dist/man/ipl.4 | 4 +-
external/bsd/ipf/dist/man/ipnat.5 | 4 +-
external/bsd/ipf/dist/man/ippool.5 | 82 +++++++++++++++++++++++++++--
external/bsd/ipf/dist/man/mkfilters.1 | 6 +-
external/bsd/ipf/dist/radix_ipf.c | 4 +-
external/bsd/ipf/dist/tools/ipfcomp.c | 6 +-
external/bsd/ipf/dist/tools/ipfstat.c | 31 +++++++----
external/bsd/ipf/dist/tools/ipftest.c | 6 +-
external/bsd/ipf/dist/tools/ipmon.c | 20 ++++---
external/bsd/ipf/dist/tools/ippool.c | 25 ++++-----
19 files changed, 220 insertions(+), 102 deletions(-)
diffs (truncated from 953 to 300 lines):
diff -r e45c4a107a47 -r 98faa6516b30 external/bsd/ipf/dist/ip_fil.c
--- a/external/bsd/ipf/dist/ip_fil.c Sat Mar 24 02:08:34 2012 +0000
+++ b/external/bsd/ipf/dist/ip_fil.c Sat Mar 24 02:19:00 2012 +0000
@@ -1,15 +1,15 @@
-/* $NetBSD: ip_fil.c,v 1.2 2012/03/23 21:28:57 christos Exp $ */
+/* $NetBSD: ip_fil.c,v 1.3 2012/03/24 02:19:00 christos Exp $ */
/*
* Copyright (C) 2012 by Darren Reed.
*
* See the IPFILTER.LICENCE file for details on licencing.
*
- * Id
+ * Id: ip_fil.c,v 2.168.2.8 2012/01/26 05:29:10 darrenr Exp
*/
#if !defined(lint)
static const char sccsid[] = "@(#)ip_fil.c 2.41 6/5/96 (C) 1993-2000 Darren Reed";
-static const char rcsid[] = "@(#)Id";
+static const char rcsid[] = "@(#)Id: ip_fil.c,v 2.168.2.8 2012/01/26 05:29:10 darrenr Exp";
#endif
#include "ipf.h"
@@ -37,10 +37,17 @@
static int write_output __P((struct ifnet *, struct mbuf *,
struct sockaddr *, struct rtentry *, char *));
# else
+#if defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 499001100)
+static int no_output(struct ifnet *, struct mbuf *,
+ const struct sockaddr *, struct rtentry *);
+static int write_output(struct ifnet *, struct mbuf *,
+ const struct sockaddr *, struct rtentry *);
+#else
static int no_output __P((struct ifnet *, struct mbuf *,
struct sockaddr *, struct rtentry *));
static int write_output __P((struct ifnet *, struct mbuf *,
struct sockaddr *, struct rtentry *));
+#endif
# endif
#endif
@@ -133,7 +140,7 @@
#endif
struct ifnet *ifp;
struct mbuf *m;
- struct sockaddr *s;
+ const struct sockaddr *s;
{
return 0;
}
@@ -153,7 +160,7 @@
#endif
struct ifnet *ifp;
struct mbuf *m;
- struct sockaddr *s;
+ const struct sockaddr *s;
{
char fname[32];
mb_t *mb;
@@ -203,7 +210,7 @@
#endif
return;
- ifa = (struct ifaddr *)malloc(sizeof(*ifa));
+ ifa = (struct ifaddr *)calloc(1, sizeof(*ifa));
#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
ifp->if_addrlist.tqh_first = ifa;
#else
@@ -289,7 +296,7 @@
#endif
if (!ifneta) {
- ifneta = (struct ifnet **)malloc(sizeof(ifp) * 2);
+ ifneta = (struct ifnet **)calloc(1, sizeof(ifp) * 2);
if (!ifneta)
return NULL;
ifneta[1] = NULL;
@@ -310,7 +317,7 @@
return NULL;
}
ifneta[nifs] = NULL;
- ifneta[nifs - 1] = (struct ifnet *)malloc(sizeof(*ifp));
+ ifneta[nifs - 1] = (struct ifnet *)calloc(1, sizeof(*ifp));
if (!ifneta[nifs - 1]) {
nifs--;
return NULL;
@@ -514,7 +521,7 @@
m_copydata(m, off, len, cp)
mb_t *m;
int off, len;
- void *cp;
+ void * cp;
{
bcopy((char *)m + off, cp, len);
}
@@ -608,7 +615,7 @@
/* */
/* Returns the next IPv4 ID to use for this packet. */
/* ------------------------------------------------------------------------ */
-INLINE u_short
+EXTERN_INLINE u_short
ipf_nextipid(fin)
fr_info_t *fin;
{
@@ -631,7 +638,7 @@
}
-INLINE int
+EXTERN_INLINE int
ipf_checkv4sum(fin)
fr_info_t *fin;
{
@@ -648,7 +655,7 @@
#ifdef USE_INET6
-INLINE int
+EXTERN_INLINE int
ipf_checkv6sum(fin)
fr_info_t *fin;
{
diff -r e45c4a107a47 -r 98faa6516b30 external/bsd/ipf/dist/ip_scan.c
--- a/external/bsd/ipf/dist/ip_scan.c Sat Mar 24 02:08:34 2012 +0000
+++ b/external/bsd/ipf/dist/ip_scan.c Sat Mar 24 02:19:00 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_scan.c,v 1.1.1.1 2012/03/23 21:19:58 christos Exp $ */
+/* $NetBSD: ip_scan.c,v 1.2 2012/03/24 02:19:00 christos Exp $ */
/*
* Copyright (C) 2009 by Darren Reed.
@@ -60,7 +60,7 @@
#if !defined(lint)
static const char sccsid[] = "@(#)ip_state.c 1.8 6/5/96 (C) 1993-2000 Darren Reed";
-static const char rcsid[] = "@(#)Id";
+static const char rcsid[] = "@(#)Id: ip_scan.c,v 2.53.2.2 2012/01/29 03:08:31 darrenr Exp";
#endif
#ifdef IPFILTER_SCAN /* endif at bottom of file */
@@ -598,7 +598,7 @@
void *ctx;
{
ipscanstat_t ipscs;
- int err = 0;
+ int err;
switch (cmd)
{
diff -r e45c4a107a47 -r 98faa6516b30 external/bsd/ipf/dist/ipsend/ip.c
--- a/external/bsd/ipf/dist/ipsend/ip.c Sat Mar 24 02:08:34 2012 +0000
+++ b/external/bsd/ipf/dist/ipsend/ip.c Sat Mar 24 02:19:00 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip.c,v 1.1.1.1 2012/03/23 21:20:06 christos Exp $ */
+/* $NetBSD: ip.c,v 1.2 2012/03/24 02:19:00 christos Exp $ */
/*
* ip.c (C) 1995-1998 Darren Reed
@@ -7,7 +7,7 @@
*/
#if !defined(lint)
static const char sccsid[] = "%W% %G% (C)1995";
-static const char rcsid[] = "@(#)Id";
+static const char rcsid[] = "@(#)Id: ip.c,v 2.12 2008/08/10 05:51:14 darrenr Exp";
#endif
#include <sys/param.h>
#include <sys/types.h>
@@ -262,7 +262,7 @@
hlen = IP_HL(ip) << 2;
t = (tcphdr_t *)((char *)ip + hlen);
ip2 = (struct ip *)lbuf;
- t2 = (tcphdr_t *)((char *)ip2 + hlen);
+ t2 = (tcphdr_t *)((char *)ip2 + sizeof(ip_t));
thlen = TCP_OFF(t) << 2;
if (!thlen)
thlen = sizeof(tcphdr_t);
diff -r e45c4a107a47 -r 98faa6516b30 external/bsd/ipf/dist/ipsend/iptest.1
--- a/external/bsd/ipf/dist/ipsend/iptest.1 Sat Mar 24 02:08:34 2012 +0000
+++ b/external/bsd/ipf/dist/ipsend/iptest.1 Sat Mar 24 02:19:00 2012 +0000
@@ -1,8 +1,8 @@
-.\" $NetBSD: iptest.1,v 1.1.1.1 2012/03/23 21:20:07 christos Exp $
+.\" $NetBSD: iptest.1,v 1.2 2012/03/24 02:19:00 christos Exp $
.\"
.TH IPTEST 1
.SH NAME
-iptest \- automatically generate a packets to test IP functionality
+iptest \- automatically generate packets to test IP functionality
.SH SYNOPSIS
.B iptest
[
@@ -93,7 +93,7 @@
Run a...
.DT
.SH SEE ALSO
-ipsend(1), ipresend(1), bpf(4), ipsend(5), dlpi(7p)
+ipresend(1), ipsend(1), bpf(4), ipsend(5)
.SH DIAGNOSTICS
Only one of the numeric test options may be given when \fIiptest\fP is run.
.PP
diff -r e45c4a107a47 -r 98faa6516b30 external/bsd/ipf/dist/lib/load_http.c
--- a/external/bsd/ipf/dist/lib/load_http.c Sat Mar 24 02:08:34 2012 +0000
+++ b/external/bsd/ipf/dist/lib/load_http.c Sat Mar 24 02:19:00 2012 +0000
@@ -1,11 +1,11 @@
-/* $NetBSD: load_http.c,v 1.1.1.1 2012/03/23 21:20:09 christos Exp $ */
+/* $NetBSD: load_http.c,v 1.2 2012/03/24 02:19:00 christos Exp $ */
/*
* Copyright (C) 2010 by Darren Reed.
*
* See the IPFILTER.LICENCE file for details on licencing.
*
- * Id: load_http.c,v 1.5.2.3 2012/01/26 05:44:26 darren_r Exp
+ * Id: load_http.c,v 1.5.2.3 2012/01/26 05:29:16 darrenr Exp
*/
#include "ipf.h"
@@ -33,6 +33,7 @@
int fd, len, left, port, endhdr, removed, linenum = 0;
char *s, *t, *u, buffer[LOAD_BUFSIZE], *myurl;
alist_t *a, *rtop, *rbot;
+ int rem;
/*
* More than this would just be absurd.
@@ -47,18 +48,21 @@
rtop = NULL;
rbot = NULL;
- sprintf(buffer, "GET %s HTTP/1.0\r\n", url);
-
myurl = strdup(url);
if (myurl == NULL)
goto done;
+ rem = sizeof(buffer);
+ left = snprintf(buffer, rem, "GET %s HTTP/1.0\r\n", url);
+ if (left < 0 || left > rem)
+ goto done;
+ rem -= left;
+
s = myurl + 7; /* http:// */
t = strchr(s, '/');
if (t == NULL) {
fprintf(stderr, "load_http has a malformed URL '%s'\n", url);
- free(myurl);
- return NULL;
+ goto done;
}
*t++ = '\0';
@@ -75,7 +79,10 @@
if (u != NULL)
s = u + 1; /* AUTH */
- sprintf(buffer + strlen(buffer), "Host: %s\r\n\r\n", s);
+ left = snprintf(buffer + left, rem, "Host: %s\r\n\r\n", s);
+ if (left < 0 || left > rem)
+ goto done;
+ rem -= left;
u = strchr(s, ':');
if (u != NULL) {
@@ -92,12 +99,9 @@
if (fd == -1)
goto done;
-
len = strlen(buffer);
- if (write(fd, buffer, len) != len) {
- close(fd);
+ if (write(fd, buffer, len) != len)
goto done;
- }
s = buffer;
endhdr = 0;
@@ -149,6 +153,20 @@
linenum++;
*t = '\0';
+ for (u = buffer; isdigit((unsigned char)*u) ||
+ (*u == '.'); u++)
+ continue;
+ if (*u == '/') {
+ char *slash;
+
+ slash = u;
+ u++;
+ while (isdigit((unsigned char)*u))
+ u++;
+ if (!isspace((unsigned char)*u) && *u)
+ u = slash;
+ }
+
/*
* Remove comment and continue to the next line if
* the comment is at the start of the line.
@@ -156,7 +174,7 @@
u = strchr(buffer, '#');
if (u != NULL) {
*u = '\0';
Home |
Main Index |
Thread Index |
Old Index