diff options
Diffstat (limited to 'contrib/ipfilter/ipsend')
28 files changed, 288 insertions, 825 deletions
diff --git a/contrib/ipfilter/ipsend/.cvsignore b/contrib/ipfilter/ipsend/.cvsignore deleted file mode 100644 index b7aea24eb881..000000000000 --- a/contrib/ipfilter/ipsend/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -ipsend -ipresend -iptest diff --git a/contrib/ipfilter/ipsend/44arp.c b/contrib/ipfilter/ipsend/44arp.c index 3fbafcc6116f..9033ab9a64ba 100644 --- a/contrib/ipfilter/ipsend/44arp.c +++ b/contrib/ipfilter/ipsend/44arp.c @@ -13,9 +13,6 @@ #endif #include <net/if_dl.h> #include <net/if_types.h> -#if defined(__FreeBSD__) -# include "radix_ipf.h" -#endif #ifndef __osf__ # include <net/route.h> #endif @@ -44,7 +41,7 @@ * (4 bytes) */ int resolve(host, address) -char *host, *address; + char *host, *address; { struct hostent *hp; u_long add; @@ -66,7 +63,7 @@ char *host, *address; int arp(addr, eaddr) -char *addr, *eaddr; + char *addr, *eaddr; { int mib[6]; size_t needed; diff --git a/contrib/ipfilter/ipsend/Makefile b/contrib/ipfilter/ipsend/Makefile index ed3a51e45370..34485efce0d6 100644 --- a/contrib/ipfilter/ipsend/Makefile +++ b/contrib/ipfilter/ipsend/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 1993-1998 by Darren Reed. +# Copyright (C) 2012 by Darren Reed. # # See the IPFILTER.LICENCE file for details on licencing. # diff --git a/contrib/ipfilter/ipsend/README b/contrib/ipfilter/ipsend/README deleted file mode 100644 index 198556d834fb..000000000000 --- a/contrib/ipfilter/ipsend/README +++ /dev/null @@ -1,8 +0,0 @@ - -This distribution contains *ONLY* the code required to build the 'ipsend' -directory of programs (including man pages) found in the IP Filter package: -http://coombs.anu.edu.au/~avalon/ip-filter.html - -Patches, bugs, etc, please send to: - -darrenr@pobox.com diff --git a/contrib/ipfilter/ipsend/arp.c b/contrib/ipfilter/ipsend/arp.c index 8670bda76b46..58a1523e5db5 100644 --- a/contrib/ipfilter/ipsend/arp.c +++ b/contrib/ipfilter/ipsend/arp.c @@ -7,7 +7,7 @@ */ #if !defined(lint) static const char sccsid[] = "@(#)arp.c 1.4 1/11/96 (C)1995 Darren Reed"; -static const char rcsid[] = "@(#)$Id: arp.c,v 2.8.2.2 2007/02/17 12:41:50 darrenr Exp $"; +static const char rcsid[] = "@(#)$Id$"; #endif #include <sys/types.h> #include <sys/socket.h> @@ -17,9 +17,6 @@ static const char rcsid[] = "@(#)$Id: arp.c,v 2.8.2.2 2007/02/17 12:41:50 darren #include <sys/ioctl.h> #include <netinet/in_systm.h> #include <netinet/in.h> -#ifdef __osf__ -# include "radix_ipf_local.h" -#endif #include <net/if.h> #include <netinet/if_ether.h> #ifndef ultrix @@ -42,7 +39,7 @@ static const char rcsid[] = "@(#)$Id: arp.c,v 2.8.2.2 2007/02/17 12:41:50 darren * (4 bytes) */ int resolve(host, address) -char *host, *address; + char *host, *address; { struct hostent *hp; u_long add; @@ -68,8 +65,8 @@ char *host, *address; * some BSD program, I cant remember which. */ int arp(ip, ether) -char *ip; -char *ether; + char *ip; + char *ether; { static int sfd = -1; static char ethersave[6], ipsave[4]; diff --git a/contrib/ipfilter/ipsend/dlcommon.c b/contrib/ipfilter/ipsend/dlcommon.c index c6b6e8a4858f..55bc9423ab15 100644 --- a/contrib/ipfilter/ipsend/dlcommon.c +++ b/contrib/ipfilter/ipsend/dlcommon.c @@ -32,18 +32,18 @@ typedef unsigned long ulong; #define CASERET(s) case s: return ("s") -char *dlprim(); -char *dlstate(); -char *dlerrno(); -char *dlpromisclevel(); -char *dlservicemode(); -char *dlstyle(); -char *dlmactype(); + char *dlprim(); + char *dlstate(); + char *dlerrno(); + char *dlpromisclevel(); + char *dlservicemode(); + char *dlstyle(); + char *dlmactype(); void dlinforeq(fd) -int fd; + int fd; { dl_info_req_t info_req; struct strbuf ctl; @@ -63,8 +63,8 @@ int fd; void dlinfoack(fd, bufp) -int fd; -char *bufp; + int fd; + char *bufp; { union DL_primitives *dlp; struct strbuf ctl; @@ -92,8 +92,8 @@ char *bufp; void dlattachreq(fd, ppa) -int fd; -u_long ppa; + int fd; + u_long ppa; { dl_attach_req_t attach_req; struct strbuf ctl; @@ -114,9 +114,9 @@ u_long ppa; void dlenabmultireq(fd, addr, length) -int fd; -char *addr; -int length; + int fd; + char *addr; + int length; { long buf[MAXDLBUF]; union DL_primitives *dlp; @@ -143,9 +143,9 @@ int length; void dldisabmultireq(fd, addr, length) -int fd; -char *addr; -int length; + int fd; + char *addr; + int length; { long buf[MAXDLBUF]; union DL_primitives *dlp; @@ -172,8 +172,8 @@ int length; void dlpromisconreq(fd, level) -int fd; -u_long level; + int fd; + u_long level; { dl_promiscon_req_t promiscon_req; struct strbuf ctl; @@ -195,8 +195,8 @@ u_long level; void dlpromiscoff(fd, level) -int fd; -u_long level; + int fd; + u_long level; { dl_promiscoff_req_t promiscoff_req; struct strbuf ctl; @@ -217,8 +217,8 @@ u_long level; void dlphysaddrreq(fd, addrtype) -int fd; -u_long addrtype; + int fd; + u_long addrtype; { dl_phys_addr_req_t phys_addr_req; struct strbuf ctl; @@ -239,9 +239,9 @@ u_long addrtype; void dlsetphysaddrreq(fd, addr, length) -int fd; -char *addr; -int length; + int fd; + char *addr; + int length; { long buf[MAXDLBUF]; union DL_primitives *dlp; @@ -268,7 +268,7 @@ int length; void dldetachreq(fd) -int fd; + int fd; { dl_detach_req_t detach_req; struct strbuf ctl; @@ -288,12 +288,12 @@ int fd; void dlbindreq(fd, sap, max_conind, service_mode, conn_mgmt, xidtest) -int fd; -u_long sap; -u_long max_conind; -u_long service_mode; -u_long conn_mgmt; -u_long xidtest; + int fd; + u_long sap; + u_long max_conind; + u_long service_mode; + u_long conn_mgmt; + u_long xidtest; { dl_bind_req_t bind_req; struct strbuf ctl; @@ -318,12 +318,12 @@ u_long xidtest; void dlunitdatareq(fd, addrp, addrlen, minpri, maxpri, datap, datalen) -int fd; -u_char *addrp; -int addrlen; -u_long minpri, maxpri; -u_char *datap; -int datalen; + int fd; + u_char *addrp; + int addrlen; + u_long minpri, maxpri; + u_char *datap; + int datalen; { long buf[MAXDLBUF]; union DL_primitives *dlp; @@ -353,7 +353,7 @@ int datalen; void dlunbindreq(fd) -int fd; + int fd; { dl_unbind_req_t unbind_req; struct strbuf ctl; @@ -373,8 +373,8 @@ int fd; void dlokack(fd, bufp) -int fd; -char *bufp; + int fd; + char *bufp; { union DL_primitives *dlp; struct strbuf ctl; @@ -402,8 +402,8 @@ char *bufp; void dlerrorack(fd, bufp) -int fd; -char *bufp; + int fd; + char *bufp; { union DL_primitives *dlp; struct strbuf ctl; @@ -431,8 +431,8 @@ char *bufp; void dlbindack(fd, bufp) -int fd; -char *bufp; + int fd; + char *bufp; { union DL_primitives *dlp; struct strbuf ctl; @@ -457,8 +457,8 @@ char *bufp; void dlphysaddrack(fd, bufp) -int fd; -char *bufp; + int fd; + char *bufp; { union DL_primitives *dlp; struct strbuf ctl; @@ -488,10 +488,10 @@ sigalrm() } strgetmsg(fd, ctlp, datap, flagsp, caller) -int fd; -struct strbuf *ctlp, *datap; -int *flagsp; -char *caller; + int fd; + struct strbuf *ctlp, *datap; + int *flagsp; + char *caller; { int rc; static char errmsg[80]; @@ -540,8 +540,8 @@ char *caller; } expecting(prim, dlp) -int prim; -union DL_primitives *dlp; + int prim; + union DL_primitives *dlp; { if (dlp->dl_primitive != (u_long)prim) { printdlprim(dlp); @@ -555,7 +555,7 @@ union DL_primitives *dlp; * Print any DLPI msg in human readable format. */ printdlprim(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { switch (dlp->dl_primitive) { case DL_INFO_REQ: @@ -659,13 +659,13 @@ union DL_primitives *dlp; /* ARGSUSED */ printdlinforeq(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { (void) printf("DL_INFO_REQ\n"); } printdlinfoack(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { u_char addr[MAXDLADDR]; u_char brdcst[MAXDLADDR]; @@ -702,21 +702,21 @@ union DL_primitives *dlp; } printdlattachreq(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { (void) printf("DL_ATTACH_REQ: ppa %d\n", dlp->attach_req.dl_ppa); } printdlokack(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { (void) printf("DL_OK_ACK: correct_primitive %s\n", dlprim(dlp->ok_ack.dl_correct_primitive)); } printdlerrorack(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { (void) printf("DL_ERROR_ACK: error_primitive %s errno %s unix_errno %d: %s\n", dlprim(dlp->error_ack.dl_error_primitive), @@ -726,7 +726,7 @@ union DL_primitives *dlp; } printdlenabmultireq(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { u_char addr[MAXDLADDR]; @@ -740,7 +740,7 @@ union DL_primitives *dlp; } printdldisabmultireq(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { u_char addr[MAXDLADDR]; @@ -754,28 +754,28 @@ union DL_primitives *dlp; } printdlpromisconreq(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { (void) printf("DL_PROMISCON_REQ: level %s\n", dlpromisclevel(dlp->promiscon_req.dl_level)); } printdlpromiscoffreq(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { (void) printf("DL_PROMISCOFF_REQ: level %s\n", dlpromisclevel(dlp->promiscoff_req.dl_level)); } printdlphysaddrreq(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { (void) printf("DL_PHYS_ADDR_REQ: addr_type 0x%x\n", dlp->physaddr_req.dl_addr_type); } printdlphysaddrack(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { u_char addr[MAXDLADDR]; @@ -789,7 +789,7 @@ union DL_primitives *dlp; } printdlsetphysaddrreq(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { u_char addr[MAXDLADDR]; @@ -804,13 +804,13 @@ union DL_primitives *dlp; /* ARGSUSED */ printdldetachreq(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { (void) printf("DL_DETACH_REQ\n"); } printdlbindreq(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { (void) printf("DL_BIND_REQ: sap %d max_conind %d\n", dlp->bind_req.dl_sap, @@ -822,7 +822,7 @@ union DL_primitives *dlp; } printdlbindack(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { u_char addr[MAXDLADDR]; @@ -841,13 +841,13 @@ union DL_primitives *dlp; /* ARGSUSED */ printdlunbindreq(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { (void) printf("DL_UNBIND_REQ\n"); } printdlsubsbindreq(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { u_char sap[MAXDLADDR]; @@ -861,7 +861,7 @@ union DL_primitives *dlp; } printdlsubsbindack(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { u_char sap[MAXDLADDR]; @@ -875,7 +875,7 @@ union DL_primitives *dlp; } printdlsubsunbindreq(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { u_char sap[MAXDLADDR]; @@ -889,7 +889,7 @@ union DL_primitives *dlp; } printdlunitdatareq(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { u_char addr[MAXDLADDR]; @@ -906,7 +906,7 @@ union DL_primitives *dlp; } printdlunitdataind(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { u_char dest[MAXDLADDR]; u_char src[MAXDLADDR]; @@ -929,7 +929,7 @@ union DL_primitives *dlp; } printdluderrorind(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { u_char addr[MAXDLADDR]; @@ -946,7 +946,7 @@ union DL_primitives *dlp; } printdltestreq(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { u_char addr[MAXDLADDR]; @@ -961,7 +961,7 @@ union DL_primitives *dlp; } printdltestind(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { u_char dest[MAXDLADDR]; u_char src[MAXDLADDR]; @@ -983,7 +983,7 @@ union DL_primitives *dlp; } printdltestres(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { u_char dest[MAXDLADDR]; @@ -998,7 +998,7 @@ union DL_primitives *dlp; } printdltestcon(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { u_char dest[MAXDLADDR]; u_char src[MAXDLADDR]; @@ -1020,7 +1020,7 @@ union DL_primitives *dlp; } printdlxidreq(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { u_char dest[MAXDLADDR]; @@ -1035,7 +1035,7 @@ union DL_primitives *dlp; } printdlxidind(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { u_char dest[MAXDLADDR]; u_char src[MAXDLADDR]; @@ -1057,7 +1057,7 @@ union DL_primitives *dlp; } printdlxidres(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { u_char dest[MAXDLADDR]; @@ -1072,7 +1072,7 @@ union DL_primitives *dlp; } printdlxidcon(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { u_char dest[MAXDLADDR]; u_char src[MAXDLADDR]; @@ -1094,7 +1094,7 @@ union DL_primitives *dlp; } printdludqosreq(dlp) -union DL_primitives *dlp; + union DL_primitives *dlp; { (void) printf("DL_UDQOS_REQ: qos_length %d qos_offset %d\n", dlp->udqos_req.dl_qos_length, @@ -1105,9 +1105,9 @@ union DL_primitives *dlp; * Return string. */ addrtostring(addr, length, s) -u_char *addr; -u_long length; -u_char *s; + u_char *addr; + u_long length; + u_char *s; { int i; @@ -1123,8 +1123,8 @@ u_char *s; * Return length */ stringtoaddr(sp, addr) -char *sp; -char *addr; + char *sp; + char *addr; { int n = 0; char *p; @@ -1140,14 +1140,14 @@ char *addr; n++; p = NULL; } - + return (n); } static char hexnibble(c) -char c; + char c; { static char hextab[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', @@ -1159,7 +1159,7 @@ char c; char* dlprim(prim) -u_long prim; + u_long prim; { static char primbuf[80]; @@ -1200,7 +1200,7 @@ u_long prim; char* dlstate(state) -u_long state; + u_long state; { static char statebuf[80]; @@ -1234,7 +1234,7 @@ u_long state; char* dlerrno(errno) -u_long errno; + u_long errno; { static char errnobuf[80]; @@ -1276,7 +1276,7 @@ u_long errno; char* dlpromisclevel(level) -u_long level; + u_long level; { static char levelbuf[80]; @@ -1292,7 +1292,7 @@ u_long level; char* dlservicemode(servicemode) -u_long servicemode; + u_long servicemode; { static char servicemodebuf[80]; @@ -1309,7 +1309,7 @@ u_long servicemode; char* dlstyle(style) -long style; + long style; { static char stylebuf[80]; @@ -1324,7 +1324,7 @@ long style; char* dlmactype(media) -u_long media; + u_long media; { static char mediabuf[80]; @@ -1345,8 +1345,8 @@ u_long media; /*VARARGS1*/ err(fmt, a1, a2, a3, a4) -char *fmt; -char *a1, *a2, *a3, *a4; + char *fmt; + char *a1, *a2, *a3, *a4; { (void) fprintf(stderr, fmt, a1, a2, a3, a4); (void) fprintf(stderr, "\n"); @@ -1354,18 +1354,18 @@ char *a1, *a2, *a3, *a4; } syserr(s) -char *s; + char *s; { (void) perror(s); exit(1); } strioctl(fd, cmd, timout, len, dp) -int fd; -int cmd; -int timout; -int len; -char *dp; + int fd; + int cmd; + int timout; + int len; + char *dp; { struct strioctl sioc; int rc; diff --git a/contrib/ipfilter/ipsend/hpux.c b/contrib/ipfilter/ipsend/hpux.c deleted file mode 100644 index 9cc72995f26b..000000000000 --- a/contrib/ipfilter/ipsend/hpux.c +++ /dev/null @@ -1,114 +0,0 @@ -/* $FreeBSD$ */ - -/* - * (C)opyright 1997-1998 Darren Reed. (from tcplog) - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and due credit is given - * to the original author and the contributors. - */ -#include <stdio.h> -#include <strings.h> -#include <unistd.h> -#include <stdlib.h> -#include <sys/types.h> -#include <sys/param.h> -#include <sys/socket.h> -#include <sys/file.h> -#include <sys/ioctl.h> - - -int initdevice(device, sport, tout) -char *device; -int sport, tout; -{ - int fd; - - if ((fd = socket(AF_DLI, SOCK_RAW, 0)) == -1) - perror("socket"); - return fd; -} - - -/* - * output an IP packet onto a fd opened for /dev/bpf - */ -int sendip(fd, pkt, len) -int fd, len; -char *pkt; -{ - if (send(fd, pkt, len, 0) == -1) - { - perror("send"); - return -1; - } - - return len; -} - - -char *strdup(str) -char *str; -{ - char *s; - - if ((s = (char *)malloc(strlen(str) + 1))) - return strcpy(s, str); - return NULL; -} -/* - * (C)opyright 1997 Darren Reed. (from tcplog) - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and due credit is given - * to the original author and the contributors. - */ -#include <stdio.h> -#include <strings.h> -#include <unistd.h> -#include <stdlib.h> -#include <sys/types.h> -#include <sys/param.h> -#include <sys/socket.h> -#include <sys/file.h> -#include <sys/ioctl.h> - - -int initdevice(device, sport, tout) -char *device; -int sport, tout; -{ - int fd; - - if ((fd = socket(AF_DLI, SOCK_RAW, 0)) == -1) - perror("socket"); - return fd; -} - - -/* - * output an IP packet onto a fd opened for /dev/bpf - */ -int sendip(fd, pkt, len) -int fd, len; -char *pkt; -{ - if (send(fd, pkt, len, 0) == -1) - { - perror("send"); - return -1; - } - - return len; -} - - -char *strdup(str) -char *str; -{ - char *s; - - if ((s = (char *)malloc(strlen(str) + 1))) - return strcpy(s, str); - return NULL; -} diff --git a/contrib/ipfilter/ipsend/in_var.h b/contrib/ipfilter/ipsend/in_var.h deleted file mode 100644 index 3523f77051fc..000000000000 --- a/contrib/ipfilter/ipsend/in_var.h +++ /dev/null @@ -1,179 +0,0 @@ -/* $FreeBSD$ */ - -/* @(#)in_var.h 1.3 88/08/19 SMI; from UCB 7.1 6/5/86 */ - -/* - * Copyright (c) 1985, 1986 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -/* - * Interface address, Internet version. One of these structures - * is allocated for each interface with an Internet address. - * The ifaddr structure contains the protocol-independent part - * of the structure and is assumed to be first. - */ - -#ifndef _netinet_in_var_h -#define _netinet_in_var_h - -struct in_ifaddr { - struct ifaddr ia_ifa; /* protocol-independent info */ -#define ia_addr ia_ifa.ifa_addr -#define ia_broadaddr ia_ifa.ifa_broadaddr -#define ia_dstaddr ia_ifa.ifa_dstaddr -#define ia_ifp ia_ifa.ifa_ifp - u_long ia_net; /* network number of interface */ - u_long ia_netmask; /* mask of net part */ - u_long ia_subnet; /* subnet number, including net */ - u_long ia_subnetmask; /* mask of net + subnet */ - struct in_addr ia_netbroadcast; /* broadcast addr for (logical) net */ - int ia_flags; - struct in_ifaddr *ia_next; /* next in list of internet addresses */ - struct in_multi *ia_multiaddrs;/* list of multicast addresses */ -}; -/* - * Given a pointer to an in_ifaddr (ifaddr), - * return a pointer to the addr as a sockadd_in. - */ -#define IA_SIN(ia) ((struct sockaddr_in *)(&((struct in_ifaddr *)ia)->ia_addr)) -/* - * ia_flags - */ -#define IFA_ROUTE 0x01 /* routing entry installed */ - -#ifdef KERNEL -struct in_ifaddr *in_ifaddr; -struct in_ifaddr *in_iaonnetof(); -struct ifqueue ipintrq; /* ip packet input queue */ -#endif - -#ifdef KERNEL -/* - * Macro for finding the interface (ifnet structure) corresponding to one - * of our IP addresses. - */ -#define INADDR_TO_IFP(addr, ifp) \ - /* struct in_addr addr; */ \ - /* struct ifnet *ifp; */ \ -{ \ - register struct in_ifaddr *ia; \ - \ - for (ia = in_ifaddr; \ - ia != NULL && IA_SIN(ia)->sin_addr.s_addr != (addr).s_addr; \ - ia = ia->ia_next); \ - (ifp) = (ia == NULL) ? NULL : ia->ia_ifp; \ -} - -/* - * Macro for finding the internet address structure (in_ifaddr) corresponding - * to a given interface (ifnet structure). - */ -#define IFP_TO_IA(ifp, ia) \ - /* struct ifnet *ifp; */ \ - /* struct in_ifaddr *ia; */ \ -{ \ - for ((ia) = in_ifaddr; \ - (ia) != NULL && (ia)->ia_ifp != (ifp); \ - (ia) = (ia)->ia_next); \ -} -#endif /* KERNEL */ - -/* - * Per-interface router version information is kept in this list. - * This information should be part of the ifnet structure but we don't wish - * to change that - as it might break a number of things - */ - -struct router_info { - struct ifnet *ifp; - int type; /* type of router which is querier on this interface */ - int time; /* # of slow timeouts since last old query */ - struct router_info *next; -}; - -/* - * Internet multicast address structure. There is one of these for each IP - * multicast group to which this host belongs on a given network interface. - * They are kept in a linked list, rooted in the interface's in_ifaddr - * structure. - */ - -struct in_multi { - struct in_addr inm_addr; /* IP multicast address */ - struct ifnet *inm_ifp; /* back pointer to ifnet */ - struct in_ifaddr *inm_ia; /* back pointer to in_ifaddr */ - u_int inm_refcount;/* no. membership claims by sockets */ - u_int inm_timer; /* IGMP membership report timer */ - struct in_multi *inm_next; /* ptr to next multicast address */ - u_int inm_state; /* state of the membership */ - struct router_info *inm_rti; /* router info*/ -}; - -#ifdef KERNEL -/* - * Structure used by macros below to remember position when stepping through - * all of the in_multi records. - */ -struct in_multistep { - struct in_ifaddr *i_ia; - struct in_multi *i_inm; -}; - -/* - * Macro for looking up the in_multi record for a given IP multicast address - * on a given interface. If no matching record is found, "inm" returns NULL. - */ -#define IN_LOOKUP_MULTI(addr, ifp, inm) \ - /* struct in_addr addr; */ \ - /* struct ifnet *ifp; */ \ - /* struct in_multi *inm; */ \ -{ \ - register struct in_ifaddr *ia; \ - \ - IFP_TO_IA((ifp), ia); \ - if (ia == NULL) \ - (inm) = NULL; \ - else \ - for ((inm) = ia->ia_multiaddrs; \ - (inm) != NULL && (inm)->inm_addr.s_addr != (addr).s_addr; \ - (inm) = inm->inm_next); \ -} - -/* - * Macro to step through all of the in_multi records, one at a time. - * The current position is remembered in "step", which the caller must - * provide. IN_FIRST_MULTI(), below, must be called to initialize "step" - * and get the first record. Both macros return a NULL "inm" when there - * are no remaining records. - */ -#define IN_NEXT_MULTI(step, inm) \ - /* struct in_multistep step; */ \ - /* struct in_multi *inm; */ \ -{ \ - if (((inm) = (step).i_inm) != NULL) { \ - (step).i_inm = (inm)->inm_next; \ - } \ - else while ((step).i_ia != NULL) { \ - (inm) = (step).i_ia->ia_multiaddrs; \ - (step).i_ia = (step).i_ia->ia_next; \ - if ((inm) != NULL) { \ - (step).i_inm = (inm)->inm_next; \ - break; \ - } \ - } \ -} - -#define IN_FIRST_MULTI(step, inm) \ - /* struct in_multistep step; */ \ - /* struct in_multi *inm; */ \ -{ \ - (step).i_ia = in_ifaddr; \ - (step).i_inm = NULL; \ - IN_NEXT_MULTI((step), (inm)); \ -} - -struct in_multi *in_addmulti(); -#endif /* KERNEL */ -#endif /*!_netinet_in_var_h*/ diff --git a/contrib/ipfilter/ipsend/ip.c b/contrib/ipfilter/ipsend/ip.c index 26a7a892bed3..74d164b6ee85 100644 --- a/contrib/ipfilter/ipsend/ip.c +++ b/contrib/ipfilter/ipsend/ip.c @@ -7,20 +7,18 @@ */ #if !defined(lint) static const char sccsid[] = "%W% %G% (C)1995"; -static const char rcsid[] = "@(#)$Id: ip.c,v 2.8.2.2 2007/02/17 12:41:51 darrenr Exp $"; +static const char rcsid[] = "@(#)$Id$"; #endif #include <sys/param.h> #include <sys/types.h> #include <netinet/in_systm.h> #include <sys/socket.h> -#ifdef __osf__ -# include "radix_ipf_local.h" -#endif #include <net/if.h> #include <netinet/in.h> #include <netinet/ip.h> #include <sys/param.h> #ifndef linux +# include <net/route.h> # include <netinet/if_ether.h> # include <netinet/ip_var.h> # if __FreeBSD_version >= 300000 @@ -39,8 +37,8 @@ static char *ipbuf = NULL, *ethbuf = NULL; u_short chksum(buf,len) -u_short *buf; -int len; + u_short *buf; + int len; { u_long sum = 0; int nwords = len >> 1; @@ -54,9 +52,9 @@ int len; int send_ether(nfd, buf, len, gwip) -int nfd, len; -char *buf; -struct in_addr gwip; + int nfd, len; + char *buf; + struct in_addr gwip; { static struct in_addr last_gw; static char last_arp[6] = { 0, 0, 0, 0, 0, 0}; @@ -89,10 +87,10 @@ struct in_addr gwip; /* */ int send_ip(nfd, mtu, ip, gwip, frag) -int nfd, mtu; -ip_t *ip; -struct in_addr gwip; -int frag; + int nfd, mtu; + ip_t *ip; + struct in_addr gwip; + int frag; { static struct in_addr last_gw, local_ip; static char local_arp[6] = { 0, 0, 0, 0, 0, 0}; @@ -250,9 +248,9 @@ int frag; * send a tcp packet. */ int send_tcp(nfd, mtu, ip, gwip) -int nfd, mtu; -ip_t *ip; -struct in_addr gwip; + int nfd, mtu; + ip_t *ip; + struct in_addr gwip; { static tcp_seq iss = 2; tcphdr_t *t, *t2; @@ -303,9 +301,9 @@ struct in_addr gwip; * send a udp packet. */ int send_udp(nfd, mtu, ip, gwip) -int nfd, mtu; -ip_t *ip; -struct in_addr gwip; + int nfd, mtu; + ip_t *ip; + struct in_addr gwip; { struct tcpiphdr *ti; int thlen; @@ -335,9 +333,9 @@ struct in_addr gwip; * send an icmp packet. */ int send_icmp(nfd, mtu, ip, gwip) -int nfd, mtu; -ip_t *ip; -struct in_addr gwip; + int nfd, mtu; + ip_t *ip; + struct in_addr gwip; { struct icmp *ic; @@ -351,9 +349,9 @@ struct in_addr gwip; int send_packet(nfd, mtu, ip, gwip) -int nfd, mtu; -ip_t *ip; -struct in_addr gwip; + int nfd, mtu; + ip_t *ip; + struct in_addr gwip; { switch (ip->ip_p) { diff --git a/contrib/ipfilter/ipsend/ip_var.h b/contrib/ipfilter/ipsend/ip_var.h deleted file mode 100644 index ab9813ec828e..000000000000 --- a/contrib/ipfilter/ipsend/ip_var.h +++ /dev/null @@ -1,125 +0,0 @@ -/* $FreeBSD$ */ - -/* @(#)ip_var.h 1.11 88/08/19 SMI; from UCB 7.1 6/5/86 */ - -/* - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -/* - * Overlay for ip header used by other protocols (tcp, udp). - */ - -#ifndef _netinet_ip_var_h -#define _netinet_ip_var_h - -struct ipovly { - caddr_t ih_next, ih_prev; /* for protocol sequence q's */ - u_char ih_x1; /* (unused) */ - u_char ih_pr; /* protocol */ - short ih_len; /* protocol length */ - struct in_addr ih_src; /* source internet address */ - struct in_addr ih_dst; /* destination internet address */ -}; - -/* - * Ip reassembly queue structure. Each fragment - * being reassembled is attached to one of these structures. - * They are timed out after ipq_ttl drops to 0, and may also - * be reclaimed if memory becomes tight. - */ -struct ipq { - struct ipq *next,*prev; /* to other reass headers */ - u_char ipq_ttl; /* time for reass q to live */ - u_char ipq_p; /* protocol of this fragment */ - u_short ipq_id; /* sequence id for reassembly */ - struct ipasfrag *ipq_next,*ipq_prev; - /* to ip headers of fragments */ - struct in_addr ipq_src,ipq_dst; -}; - -/* - * Ip header, when holding a fragment. - * - * Note: ipf_next must be at same offset as ipq_next above - */ -struct ipasfrag { -#if defined(vax) || defined(i386) - u_char ip_hl:4, - ip_v:4; -#endif -#if defined(mc68000) || defined(sparc) - u_char ip_v:4, - ip_hl:4; -#endif - u_char ipf_mff; /* copied from (ip_off&IP_MF) */ - short ip_len; - u_short ip_id; - short ip_off; - u_char ip_ttl; - u_char ip_p; - u_short ip_sum; - struct ipasfrag *ipf_next; /* next fragment */ - struct ipasfrag *ipf_prev; /* previous fragment */ -}; - -/* - * Structure stored in mbuf in inpcb.ip_options - * and passed to ip_output when ip options are in use. - * The actual length of the options (including ipopt_dst) - * is in m_len. - */ -#define MAX_IPOPTLEN 40 - -struct ipoption { - struct in_addr ipopt_dst; /* first-hop dst if source routed */ - char ipopt_list[MAX_IPOPTLEN]; /* options proper */ -}; - -/* - * Structure stored in an mbuf attached to inpcb.ip_moptions and - * passed to ip_output when IP multicast options are in use. - */ -struct ip_moptions { - struct ifnet *imo_multicast_ifp; /* ifp for outgoing multicasts */ - u_char imo_multicast_ttl; /* TTL for outgoing multicasts */ - u_char imo_multicast_loop; /* 1 => hear sends if a member */ - u_short imo_num_memberships;/* no. memberships this socket */ - struct in_multi *imo_membership[IP_MAX_MEMBERSHIPS]; -#ifdef RSVP_ISI - long imo_multicast_vif; /* vif for outgoing multicasts */ -#endif /* RSVP_ISI */ -}; - -struct ipstat { - long ips_total; /* total packets received */ - long ips_badsum; /* checksum bad */ - long ips_tooshort; /* packet too short */ - long ips_toosmall; /* not enough data */ - long ips_badhlen; /* ip header length < data size */ - long ips_badlen; /* ip length < ip header length */ - long ips_fragments; /* fragments received */ - long ips_fragdropped; /* frags dropped (dups, out of space) */ - long ips_fragtimeout; /* fragments timed out */ - long ips_forward; /* packets forwarded */ - long ips_cantforward; /* packets rcvd for unreachable dest */ - long ips_redirectsent; /* packets forwarded on same net */ -}; - -#ifdef KERNEL -/* flags passed to ip_output as last parameter */ -#define IP_FORWARDING 0x1 /* most of ip header exists */ -#define IP_MULTICASTOPTS 0x2 /* multicast opts present */ -#define IP_ROUTETOIF SO_DONTROUTE /* bypass routing tables */ -#define IP_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */ - -struct ipstat ipstat; -struct ipq ipq; /* ip reass. queue */ -u_short ip_id; /* ip packet ctr, for ids */ - -struct mbuf *ip_srcroute(); -#endif - -#endif /*!_netinet_ip_var_h*/ diff --git a/contrib/ipfilter/ipsend/ipresend.c b/contrib/ipfilter/ipsend/ipresend.c index 050aecf2093c..7520a0e5bf55 100644 --- a/contrib/ipfilter/ipsend/ipresend.c +++ b/contrib/ipfilter/ipsend/ipresend.c @@ -8,7 +8,7 @@ */ #if !defined(lint) static const char sccsid[] = "%W% %G% (C)1995 Darren Reed"; -static const char rcsid[] = "@(#)$Id: ipresend.c,v 2.4 2004/01/08 13:34:31 darrenr Exp $"; +static const char rcsid[] = "@(#)$Id$"; #endif #include <sys/param.h> #include <sys/types.h> @@ -32,7 +32,7 @@ static const char rcsid[] = "@(#)$Id: ipresend.c,v 2.4 2004/01/08 13:34:31 darre extern char *optarg; extern int optind; #ifndef NO_IPF -extern struct ipread snoop, pcap, etherf, iphex, tcpd, iptext; +extern struct ipread pcap, iphex, iptext; #endif int opts = 0; @@ -68,7 +68,7 @@ int main __P((int, char **)); static void usage(prog) -char *prog; + char *prog; { fprintf(stderr, "Usage: %s [options] <-r filename|-R filename>\n\ \t\t-r filename\tsnoop data file to resend\n\ @@ -83,8 +83,8 @@ char *prog; int main(argc, argv) -int argc; -char **argv; + int argc; + char **argv; { struct in_addr gwip; struct ipread *ipr = NULL; @@ -115,21 +115,12 @@ char **argv; opts |= OPT_RAW; break; #ifndef NO_IPF - case 'E' : - ipr = ðerf; - break; case 'H' : ipr = &iphex; break; case 'P' : ipr = &pcap; break; - case 'S' : - ipr = &snoop; - break; - case 'T' : - ipr = &tcpd; - break; case 'X' : ipr = &iptext; break; diff --git a/contrib/ipfilter/ipsend/ipsend.5 b/contrib/ipfilter/ipsend/ipsend.5 index cd5842cbba18..fc8691198247 100644 --- a/contrib/ipfilter/ipsend/ipsend.5 +++ b/contrib/ipfilter/ipsend/ipsend.5 @@ -123,7 +123,7 @@ be adjusted to accommodate data or further protocol headers. sets the fragment offset field of the IP packet. Default is 0. .TP .B ttl <number> -sets the time to live (TTL) field of the IP header. Default is 60. +sets the time to live (TTL) field of the IP header. Default is 60. .TP .B proto <protocol> sets the protocol field of the IP header. The protocol can either be a diff --git a/contrib/ipfilter/ipsend/ipsend.c b/contrib/ipfilter/ipsend/ipsend.c index 06191ec054b9..3df5c071e2e3 100644 --- a/contrib/ipfilter/ipsend/ipsend.c +++ b/contrib/ipfilter/ipsend/ipsend.c @@ -6,7 +6,7 @@ */ #if !defined(lint) static const char sccsid[] = "@(#)ipsend.c 1.5 12/10/95 (C)1995 Darren Reed"; -static const char rcsid[] = "@(#)$Id: ipsend.c,v 2.8.2.3 2006/03/17 13:45:34 darrenr Exp $"; +static const char rcsid[] = "@(#)$Id$"; #endif #include <sys/param.h> #include <sys/types.h> @@ -67,7 +67,7 @@ int main __P((int, char **)); static void usage(prog) -char *prog; + char *prog; { fprintf(stderr, "Usage: %s [options] dest [flags]\n\ \toptions:\n\ @@ -96,8 +96,8 @@ char *prog; static void do_icmp(ip, args) -ip_t *ip; -char *args; + ip_t *ip; + char *args; { struct icmp *ic; char *s; @@ -147,10 +147,10 @@ char *args; int send_packets(dev, mtu, ip, gwip) -char *dev; -int mtu; -ip_t *ip; -struct in_addr gwip; + char *dev; + int mtu; + ip_t *ip; + struct in_addr gwip; { int wfd; @@ -193,8 +193,8 @@ udpcksum(ip_t *ip, struct udphdr *udp, int len) } int main(argc, argv) -int argc; -char **argv; + int argc; + char **argv; { FILE *langfile = NULL; struct in_addr gwip; diff --git a/contrib/ipfilter/ipsend/ipsend.h b/contrib/ipfilter/ipsend/ipsend.h index 91cfa6c085ed..75a0496e7f83 100644 --- a/contrib/ipfilter/ipsend/ipsend.h +++ b/contrib/ipfilter/ipsend/ipsend.h @@ -29,7 +29,9 @@ #ifdef linux #include <linux/sockios.h> #endif -#include "tcpip.h" +/* XXX: The following is needed by tcpip.h */ +#include <netinet/ip_var.h> +#include "netinet/tcpip.h" #include "ipt.h" extern int resolve __P((char *, char *)); diff --git a/contrib/ipfilter/ipsend/ipsopt.c b/contrib/ipfilter/ipsend/ipsopt.c index 10f132e6da9a..a2cc4d04aad1 100644 --- a/contrib/ipfilter/ipsend/ipsopt.c +++ b/contrib/ipfilter/ipsend/ipsopt.c @@ -1,14 +1,14 @@ /* $FreeBSD$ */ /* - * Copyright (C) 1995-1998 by Darren Reed. + * Copyright (C) 2012 by Darren Reed. * * See the IPFILTER.LICENCE file for details on licencing. * */ #if !defined(lint) static const char sccsid[] = "@(#)ipsopt.c 1.2 1/11/96 (C)1995 Darren Reed"; -static const char rcsid[] = "@(#)$Id: ipsopt.c,v 2.4.4.1 2004/03/23 12:58:05 darrenr Exp $"; +static const char rcsid[] = "@(#)$Id$"; #endif #include <sys/param.h> #include <sys/types.h> @@ -62,7 +62,7 @@ struct ipopt_names secnames[] = { u_short ipseclevel(slevel) -char *slevel; + char *slevel; { struct ipopt_names *so; @@ -79,10 +79,10 @@ char *slevel; int addipopt(op, io, len, class) -char *op; -struct ipopt_names *io; -int len; -char *class; + char *op; + struct ipopt_names *io; + int len; + char *class; { struct in_addr ipadr; int olen = len, srr = 0; @@ -150,8 +150,8 @@ char *class; u_32_t buildopts(cp, op, len) -char *cp, *op; -int len; + char *cp, *op; + int len; { struct ipopt_names *io; u_32_t msk = 0; diff --git a/contrib/ipfilter/ipsend/iptest.c b/contrib/ipfilter/ipsend/iptest.c index cc2ceb8ae2a1..c6cfb1c75a4a 100644 --- a/contrib/ipfilter/ipsend/iptest.c +++ b/contrib/ipfilter/ipsend/iptest.c @@ -8,7 +8,7 @@ */ #if !defined(lint) static const char sccsid[] = "%W% %G% (C)1995 Darren Reed"; -static const char rcsid[] = "@(#)$Id: iptest.c,v 2.6 2004/01/08 13:34:31 darrenr Exp $"; +static const char rcsid[] = "@(#)$Id$"; #endif #include <sys/param.h> #include <sys/types.h> @@ -63,7 +63,7 @@ int main __P((int, char **)); static void usage(prog) -char *prog; + char *prog; { fprintf(stderr, "Usage: %s [options] dest\n\ \toptions:\n\ @@ -85,8 +85,8 @@ char *prog; int main(argc, argv) -int argc; -char **argv; + int argc; + char **argv; { struct tcpiphdr *ti; struct in_addr gwip; diff --git a/contrib/ipfilter/ipsend/iptests.c b/contrib/ipfilter/ipsend/iptests.c index 22ef71f5fddc..0ca02db0b04d 100644 --- a/contrib/ipfilter/ipsend/iptests.c +++ b/contrib/ipfilter/ipsend/iptests.c @@ -1,14 +1,14 @@ /* $FreeBSD$ */ /* - * Copyright (C) 1993-1998 by Darren Reed. + * Copyright (C) 2012 by Darren Reed. * * See the IPFILTER.LICENCE file for details on licencing. * */ #if !defined(lint) static const char sccsid[] = "%W% %G% (C)1995 Darren Reed"; -static const char rcsid[] = "@(#)$Id: iptests.c,v 2.8.2.9 2007/09/13 07:19:34 darrenr Exp $"; +static const char rcsid[] = "@(#)$Id$"; #endif #include <sys/param.h> #include <sys/types.h> @@ -22,7 +22,7 @@ typedef int boolean_t; #endif #include <sys/time.h> #if !defined(__osf__) -# ifdef __NetBSD__ +# ifdef __NetBSD__ # include <machine/lock.h> # include <machine/mutex.h> # endif @@ -52,8 +52,9 @@ typedef int boolean_t; #endif #if defined(solaris) # include <sys/stream.h> +#else +# include <sys/socketvar.h> #endif -#include <sys/socketvar.h> #ifdef sun #include <sys/systm.h> #include <sys/session.h> @@ -68,9 +69,6 @@ typedef int boolean_t; #ifdef __hpux # define _NET_ROUTE_INCLUDED #endif -#ifdef __osf__ -# include "radix_ipf_local.h" -#endif #include <net/if.h> #if defined(linux) && (LINUX >= 0200) # include <asm/atomic.h> @@ -79,7 +77,9 @@ typedef int boolean_t; # if defined(__FreeBSD__) # include "radix_ipf.h" # endif -# include <net/route.h> +# if !defined(solaris) +# include <net/route.h> +# endif #else # define __KERNEL__ /* because there's a macro not wrapped by this */ # include <net/route.h> /* in this file :-/ */ @@ -87,12 +87,6 @@ typedef int boolean_t; #include <netinet/in.h> #include <arpa/inet.h> #include <netinet/ip.h> -#if !defined(linux) -# include <netinet/ip_var.h> -# if !defined(__hpux) -# include <netinet/in_pcb.h> -# endif -#endif #if defined(__SVR4) || defined(__svr4__) || defined(__sgi) # include <sys/sysmacros.h> #endif @@ -103,6 +97,12 @@ typedef int boolean_t; #ifdef __hpux # undef _NET_ROUTE_INCLUDED #endif +#if !defined(linux) +# include <netinet/ip_var.h> +# if !defined(__hpux) && !defined(solaris) +# include <netinet/in_pcb.h> +# endif +#endif #include "ipsend.h" #if !defined(linux) && !defined(__hpux) # include <netinet/tcp_timer.h> @@ -123,11 +123,11 @@ typedef int boolean_t; void ip_test1(dev, mtu, ip, gwip, ptest) -char *dev; -int mtu; -ip_t *ip; -struct in_addr gwip; -int ptest; + char *dev; + int mtu; + ip_t *ip; + struct in_addr gwip; + int ptest; { #ifdef USE_NANOSLEEP struct timespec ts; @@ -474,11 +474,11 @@ int ptest; void ip_test2(dev, mtu, ip, gwip, ptest) -char *dev; -int mtu; -ip_t *ip; -struct in_addr gwip; -int ptest; + char *dev; + int mtu; + ip_t *ip; + struct in_addr gwip; + int ptest; { #ifdef USE_NANOSLEEP struct timespec ts; @@ -570,11 +570,11 @@ int ptest; * test 3 (ICMP) */ void ip_test3(dev, mtu, ip, gwip, ptest) -char *dev; -int mtu; -ip_t *ip; -struct in_addr gwip; -int ptest; + char *dev; + int mtu; + ip_t *ip; + struct in_addr gwip; + int ptest; { static int ict1[10] = { 8, 9, 10, 13, 14, 15, 16, 17, 18, 0 }; static int ict2[8] = { 3, 9, 10, 13, 14, 17, 18, 0 }; @@ -771,11 +771,11 @@ int ptest; /* Perform test 4 (UDP) */ void ip_test4(dev, mtu, ip, gwip, ptest) -char *dev; -int mtu; -ip_t *ip; -struct in_addr gwip; -int ptest; + char *dev; + int mtu; + ip_t *ip; + struct in_addr gwip; + int ptest; { #ifdef USE_NANOSLEEP struct timespec ts; @@ -936,11 +936,11 @@ int ptest; /* Perform test 5 (TCP) */ void ip_test5(dev, mtu, ip, gwip, ptest) -char *dev; -int mtu; -ip_t *ip; -struct in_addr gwip; -int ptest; + char *dev; + int mtu; + ip_t *ip; + struct in_addr gwip; + int ptest; { #ifdef USE_NANOSLEEP struct timespec ts; @@ -1286,11 +1286,11 @@ skip_five_and_six: /* Perform test 6 (exhaust mbuf test) */ void ip_test6(dev, mtu, ip, gwip, ptest) -char *dev; -int mtu; -ip_t *ip; -struct in_addr gwip; -int ptest; + char *dev; + int mtu; + ip_t *ip; + struct in_addr gwip; + int ptest; { #ifdef USE_NANOSLEEP struct timespec ts; @@ -1368,11 +1368,11 @@ int ptest; static u_long tbuf[64]; void ip_test7(dev, mtu, ip, gwip, ptest) -char *dev; -int mtu; -ip_t *ip; -struct in_addr gwip; -int ptest; + char *dev; + int mtu; + ip_t *ip; + struct in_addr gwip; + int ptest; { ip_t *pip; #ifdef USE_NANOSLEEP diff --git a/contrib/ipfilter/ipsend/larp.c b/contrib/ipfilter/ipsend/larp.c index ccb70cc29368..5b79f7376a12 100644 --- a/contrib/ipfilter/ipsend/larp.c +++ b/contrib/ipfilter/ipsend/larp.c @@ -8,7 +8,7 @@ */ #if !defined(lint) static const char sccsid[] = "@(#)larp.c 1.1 8/19/95 (C)1995 Darren Reed"; -static const char rcsid[] = "@(#)$Id: larp.c,v 2.4 2003/12/01 02:01:16 darrenr Exp $"; +static const char rcsid[] = "@(#)$Id$"; #endif #include <sys/param.h> #include <sys/types.h> @@ -30,7 +30,7 @@ static const char rcsid[] = "@(#)$Id: larp.c,v 2.4 2003/12/01 02:01:16 darrenr E * (4 bytes) */ int resolve(host, address) -char *host, *address; + char *host, *address; { struct hostent *hp; u_long add; @@ -56,8 +56,8 @@ char *host, *address; * some BSD program, I cant remember which. */ int arp(ip, ether) -char *ip; -char *ether; + char *ip; + char *ether; { static int s = -1; struct arpreq ar; diff --git a/contrib/ipfilter/ipsend/linux.h b/contrib/ipfilter/ipsend/linux.h index a36d1bfb6a6a..e738f3ba426a 100644 --- a/contrib/ipfilter/ipsend/linux.h +++ b/contrib/ipfilter/ipsend/linux.h @@ -1,7 +1,7 @@ /* $FreeBSD$ */ /* - * Copyright (C) 1995-1998 by Darren Reed. + * Copyright (C) 2012 by Darren Reed. * * This code may be freely distributed as long as it retains this notice * and is not changed in any way. The author accepts no responsibility diff --git a/contrib/ipfilter/ipsend/lsock.c b/contrib/ipfilter/ipsend/lsock.c index a76bbbb15221..5cf2bf7ff3da 100644 --- a/contrib/ipfilter/ipsend/lsock.c +++ b/contrib/ipfilter/ipsend/lsock.c @@ -8,7 +8,7 @@ */ #if !defined(lint) static const char sccsid[] = "@(#)lsock.c 1.2 1/11/96 (C)1995 Darren Reed"; -static const char rcsid[] = "@(#)$Id: lsock.c,v 2.3.4.1 2006/03/17 13:45:34 darrenr Exp $"; +static const char rcsid[] = "@(#)$Id$"; #endif #include <stdio.h> #include <unistd.h> @@ -66,9 +66,9 @@ struct task_struct *proc; #endif int kmemcpy(buf, pos, n) -char *buf; -void *pos; -int n; + char *buf; + void *pos; + int n; { static int kfd = -1; @@ -150,8 +150,8 @@ struct task_struct *getproc() struct sock *find_tcp(fd, ti) -int fd; -struct tcpiphdr *ti; + int fd; + struct tcpiphdr *ti; { struct sock *s; struct inode *i; @@ -189,10 +189,10 @@ struct tcpiphdr *ti; } int do_socket(dev, mtu, ti, gwip) -char *dev; -int mtu; -struct tcpiphdr *ti; -struct in_addr gwip; + char *dev; + int mtu; + struct tcpiphdr *ti; + struct in_addr gwip; { struct sockaddr_in rsin, lsin; struct sock *s, sk; diff --git a/contrib/ipfilter/ipsend/resend.c b/contrib/ipfilter/ipsend/resend.c index b988e9b20d94..d113af38857e 100644 --- a/contrib/ipfilter/ipsend/resend.c +++ b/contrib/ipfilter/ipsend/resend.c @@ -8,15 +8,12 @@ */ #if !defined(lint) static const char sccsid[] = "@(#)resend.c 1.3 1/11/96 (C)1995 Darren Reed"; -static const char rcsid[] = "@(#)$Id: resend.c,v 2.8.2.3 2007/02/17 12:41:51 darrenr Exp $"; +static const char rcsid[] = "@(#)$Id$"; #endif #include <sys/param.h> #include <sys/types.h> #include <sys/time.h> #include <sys/socket.h> -#ifdef __osf__ -# include "radix_ipf_local.h" -#endif #include <net/if.h> #include <netinet/in.h> #include <arpa/inet.h> @@ -38,12 +35,11 @@ static const char rcsid[] = "@(#)$Id: resend.c,v 2.8.2.3 2007/02/17 12:41:51 dar extern int opts; -static u_char pbuf[65536]; /* 1 big packet */ -void printpacket __P((ip_t *)); +void dumppacket __P((ip_t *)); -void printpacket(ip) -ip_t *ip; +void dumppacket(ip) + ip_t *ip; { tcphdr_t *t; int i, j; @@ -73,16 +69,17 @@ ip_t *ip; int ip_resend(dev, mtu, r, gwip, datain) -char *dev; -int mtu; -struct in_addr gwip; -struct ipread *r; -char *datain; + char *dev; + int mtu; + struct in_addr gwip; + struct ipread *r; + char *datain; { ether_header_t *eh; char dhost[6]; ip_t *ip; int fd, wfd = initdevice(dev, 5), len, i; + mb_t mb; if (wfd == -1) return -1; @@ -95,7 +92,7 @@ char *datain; if (fd < 0) exit(-1); - ip = (struct ip *)pbuf; + ip = (struct ip *)mb.mb_buf; eh = (ether_header_t *)malloc(sizeof(*eh)); if(!eh) { @@ -111,7 +108,7 @@ char *datain; return -2; } - while ((i = (*r->r_readip)((char *)pbuf, sizeof(pbuf), NULL, NULL)) > 0) + while ((i = (*r->r_readip)(&mb, NULL, NULL)) > 0) { if (!(opts & OPT_RAW)) { len = ntohs(ip->ip_len); @@ -131,9 +128,9 @@ char *datain; IP_HL(ip) << 2); bcopy(ip, (char *)(eh + 1), len); len += sizeof(*eh); - printpacket(ip); + dumppacket(ip); } else { - eh = (ether_header_t *)pbuf; + eh = (ether_header_t *)mb.mb_buf; len = i; } diff --git a/contrib/ipfilter/ipsend/sbpf.c b/contrib/ipfilter/ipsend/sbpf.c index 2b356b6ffd67..fcb66bc9ca2f 100644 --- a/contrib/ipfilter/ipsend/sbpf.c +++ b/contrib/ipfilter/ipsend/sbpf.c @@ -26,7 +26,8 @@ #include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/ip.h> -#include <netinet/ip_var.h> +#include <netinet/udp.h> +#include <netinet/tcp.h> #include <stdio.h> #include <netdb.h> @@ -44,7 +45,7 @@ #if !defined(lint) static const char sccsid[] = "@(#)sbpf.c 1.3 8/25/95 (C)1995 Darren Reed"; -static const char rcsid[] = "@(#)$Id: sbpf.c,v 2.5.4.1 2006/03/21 16:32:58 darrenr Exp $"; +static const char rcsid[] = "@(#)$Id$"; #endif /* @@ -55,8 +56,8 @@ static int bufsize = 0, timeout = 1; int initdevice(device, tout) -char *device; -int tout; + char *device; + int tout; { struct bpf_version bv; struct timeval to; @@ -139,9 +140,9 @@ int tout; * output an IP packet onto a fd opened for /dev/bpf */ int sendip(fd, pkt, len) -int fd, len; -char *pkt; -{ + int fd, len; + char *pkt; +{ if (write(fd, pkt, len) == -1) { perror("send"); diff --git a/contrib/ipfilter/ipsend/sdlpi.c b/contrib/ipfilter/ipsend/sdlpi.c index f48fd06bbc34..1aee2e4108c6 100644 --- a/contrib/ipfilter/ipsend/sdlpi.c +++ b/contrib/ipfilter/ipsend/sdlpi.c @@ -27,7 +27,6 @@ #endif #ifdef __osf__ # include <sys/dlpihdr.h> -# include "radix_ipf_local.h" #else # include <sys/dlpi.h> #endif @@ -49,7 +48,7 @@ #if !defined(lint) static const char sccsid[] = "@(#)sdlpi.c 1.3 10/30/95 (C)1995 Darren Reed"; -static const char rcsid[] = "@(#)$Id: sdlpi.c,v 2.8.2.2 2007/02/17 12:41:51 darrenr Exp $"; +static const char rcsid[] = "@(#)$Id$"; #endif #define CHUNKSIZE 8192 @@ -61,8 +60,8 @@ static const char rcsid[] = "@(#)$Id: sdlpi.c,v 2.8.2.2 2007/02/17 12:41:51 darr * interface are included in the header size. */ int initdevice(device, tout) -char *device; -int tout; + char *device; + int tout; { char devname[16], *s, buf[256]; int i, fd; @@ -136,9 +135,9 @@ int tout; * output an IP packet onto a fd opened for /dev/nit */ int sendip(fd, pkt, len) -int fd, len; -char *pkt; -{ + int fd, len; + char *pkt; +{ struct strbuf dbuf, *dp = &dbuf, *cp = NULL; int pri = 0; #ifdef DL_HP_RAWDLS diff --git a/contrib/ipfilter/ipsend/sirix.c b/contrib/ipfilter/ipsend/sirix.c index 5057c4f2c871..3b565b19220c 100644 --- a/contrib/ipfilter/ipsend/sirix.c +++ b/contrib/ipfilter/ipsend/sirix.c @@ -60,7 +60,7 @@ int initdevice(char *device, int tout) * output an IP packet */ int sendip(int fd, char *pkt, int len) -{ +{ struct sockaddr_raw sr; int srlen = sizeof(sr); struct ifreq ifr; diff --git a/contrib/ipfilter/ipsend/slinux.c b/contrib/ipfilter/ipsend/slinux.c index 7e37b3087f97..7405d5e503a5 100644 --- a/contrib/ipfilter/ipsend/slinux.c +++ b/contrib/ipfilter/ipsend/slinux.c @@ -30,7 +30,7 @@ #if !defined(lint) static const char sccsid[] = "@(#)slinux.c 1.2 8/25/95"; -static const char rcsid[] = "@(#)$Id: slinux.c,v 2.3 2001/06/09 17:09:26 darrenr Exp $"; +static const char rcsid[] = "@(#)$Id$"; #endif #define CHUNKSIZE 8192 @@ -46,8 +46,8 @@ static char *eth_dev = NULL; int initdevice(dev, spare) -char *dev; -int spare; + char *dev; + int spare; { int fd; @@ -66,8 +66,8 @@ int spare; * output an IP packet onto a fd opened for /dev/nit */ int sendip(fd, pkt, len) -int fd, len; -char *pkt; + int fd, len; + char *pkt; { struct sockaddr s; struct ifreq ifr; diff --git a/contrib/ipfilter/ipsend/snit.c b/contrib/ipfilter/ipsend/snit.c index 0ef7e5444841..0d75b4e616f5 100644 --- a/contrib/ipfilter/ipsend/snit.c +++ b/contrib/ipfilter/ipsend/snit.c @@ -41,7 +41,7 @@ #if !defined(lint) static const char sccsid[] = "@(#)snit.c 1.5 1/11/96 (C)1995 Darren Reed"; -static const char rcsid[] = "@(#)$Id: snit.c,v 2.3 2001/06/09 17:09:26 darrenr Exp $"; +static const char rcsid[] = "@(#)$Id$"; #endif #define CHUNKSIZE 8192 @@ -58,8 +58,8 @@ static int timeout; int initdevice(device, tout) -char *device; -int tout; + char *device; + int tout; { struct strioctl si; struct timeval to; @@ -115,9 +115,9 @@ int tout; * output an IP packet onto a fd opened for /dev/nit */ int sendip(fd, pkt, len) -int fd, len; -char *pkt; -{ + int fd, len; + char *pkt; +{ struct sockaddr sk, *sa = &sk; struct strbuf cbuf, *cp = &cbuf, dbuf, *dp = &dbuf; diff --git a/contrib/ipfilter/ipsend/sock.c b/contrib/ipfilter/ipsend/sock.c index dcff6ebbfcec..6d0f3dbac2bb 100644 --- a/contrib/ipfilter/ipsend/sock.c +++ b/contrib/ipfilter/ipsend/sock.c @@ -7,7 +7,7 @@ */ #if !defined(lint) static const char sccsid[] = "@(#)sock.c 1.2 1/11/96 (C)1995 Darren Reed"; -static const char rcsid[] = "@(#)$Id: sock.c,v 2.8.4.7 2007/09/13 07:19:34 darrenr Exp $"; +static const char rcsid[] = "@(#)$Id$"; #endif #include <sys/param.h> #include <sys/types.h> @@ -30,9 +30,8 @@ typedef int boolean_t; # include <sys/dir.h> #endif #if !defined(__osf__) -# ifdef __NetBSD__ +# ifdef __NetBSD__ # include <machine/lock.h> -# include <machine/mutex.h> # endif # ifdef __FreeBSD__ # define _WANT_FILE @@ -75,9 +74,6 @@ typedef int boolean_t; #include <netinet/ip.h> #include <netinet/tcp.h> #include <net/if.h> -#if defined(__FreeBSD__) -# include "radix_ipf.h" -#endif #ifndef __osf__ # include <net/route.h> #endif @@ -123,9 +119,9 @@ static struct kinfo_proc *getproc __P((void)); int kmemcpy(buf, pos, n) -char *buf; -void *pos; -int n; + char *buf; + void *pos; + int n; { static int kfd = -1; off_t offset = (u_long)pos; @@ -203,8 +199,8 @@ static struct proc *getproc() struct tcpcb *find_tcp(fd, ti) -int fd; -struct tcpiphdr *ti; + int fd; + struct tcpiphdr *ti; { struct tcpcb *t; struct inpcb *i; @@ -294,8 +290,8 @@ static struct kinfo_proc *getproc() struct tcpcb *find_tcp(tfd, ti) -int tfd; -struct tcpiphdr *ti; + int tfd; + struct tcpiphdr *ti; { struct tcpcb *t; struct inpcb *i; @@ -390,10 +386,10 @@ finderror: #endif /* BSD < 199301 */ int do_socket(dev, mtu, ti, gwip) -char *dev; -int mtu; -struct tcpiphdr *ti; -struct in_addr gwip; + char *dev; + int mtu; + struct tcpiphdr *ti; + struct in_addr gwip; { struct sockaddr_in rsin, lsin; struct tcpcb *t, tcb; diff --git a/contrib/ipfilter/ipsend/tcpip.h b/contrib/ipfilter/ipsend/tcpip.h deleted file mode 100644 index 34178931a978..000000000000 --- a/contrib/ipfilter/ipsend/tcpip.h +++ /dev/null @@ -1,86 +0,0 @@ -/* $FreeBSD$ */ - -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)tcpip.h 8.1 (Berkeley) 6/10/93 - * $Id: tcpip.h,v 2.2.2.3 2004/05/26 15:45:48 darrenr Exp $ - */ - -#ifndef _NETINET_TCPIP_H_ -#define _NETINET_TCPIP_H_ - -# if defined(linux) && !defined(LINUX_IPOVLY) -# define LINUX_IPOVLY -struct ipovly { - caddr_t ih_next, ih_prev; /* for protocol sequence q's */ - u_char ih_x1; /* (unused) */ - u_char ih_pr; /* protocol */ - short ih_len; /* protocol length */ - struct in_addr ih_src; /* source internet address */ - struct in_addr ih_dst; /* destination internet address */ -}; -# endif - -/* - * Tcp+ip header, after ip options removed. - */ -struct tcpiphdr { - struct ipovly ti_i; /* overlaid ip structure */ - struct tcphdr ti_t; /* tcp header */ -}; - -#ifdef notyet -/* - * Tcp+ip header, after ip options removed but including TCP options. - */ -struct full_tcpiphdr { - struct ipovly ti_i; /* overlaid ip structure */ - struct tcphdr ti_t; /* tcp header */ - char ti_o[TCP_MAXOLEN]; /* space for tcp options */ -}; -#endif /* notyet */ -#define ti_next ti_i.ih_next -#define ti_prev ti_i.ih_prev -#define ti_x1 ti_i.ih_x1 -#define ti_pr ti_i.ih_pr -#define ti_len ti_i.ih_len -#define ti_src ti_i.ih_src -#define ti_dst ti_i.ih_dst -#define ti_sport ti_t.th_sport -#define ti_dport ti_t.th_dport -#define ti_seq ti_t.th_seq -#define ti_ack ti_t.th_ack -#define ti_x2 ti_t.th_x2 -#define ti_off ti_t.th_off -#define ti_flags ti_t.th_flags -#define ti_win ti_t.th_win -#define ti_sum ti_t.th_sum -#define ti_urp ti_t.th_urp - -#endif |
