move ipfilter2netbsd, and remove extra copies of opt.c that got added.
This commit is contained in:
parent
6c717dd82c
commit
a3ca95f80d
@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# $NetBSD: ipfilter2netbsd,v 1.5 1997/04/13 18:42:20 veego Exp $
|
||||
# $NetBSD: ipfilter2netbsd,v 1.1 1997/05/04 15:10:36 mrg Exp $
|
||||
#
|
||||
# Copyright (c) 1996 Matthew R. Green
|
||||
# All rights reserved.
|
||||
@ -76,7 +76,7 @@ mv ipf.1 ipf.8
|
||||
|
||||
echo creating Makefile
|
||||
cat > Makefile<<'__eof_makefile'
|
||||
# $NetBSD: ipfilter2netbsd,v 1.5 1997/04/13 18:42:20 veego Exp $
|
||||
# $NetBSD: ipfilter2netbsd,v 1.1 1997/05/04 15:10:36 mrg Exp $
|
||||
|
||||
PROG= ipf
|
||||
SRCS= ipf.c parse.c opt.c
|
||||
@ -103,7 +103,7 @@ cd $d/src/usr.sbin/ipf/ipfstat
|
||||
|
||||
echo creating Makefile
|
||||
cat > Makefile<<'__eof_makefile'
|
||||
# $NetBSD: ipfilter2netbsd,v 1.5 1997/04/13 18:42:20 veego Exp $
|
||||
# $NetBSD: ipfilter2netbsd,v 1.1 1997/05/04 15:10:36 mrg Exp $
|
||||
|
||||
PROG= ipfstat
|
||||
SRCS= kmem.c fils.c opt.c parse.c
|
||||
@ -119,7 +119,7 @@ __eof_makefile
|
||||
### start ipftest ###############################
|
||||
cd $r
|
||||
echo ipftest:
|
||||
src='ipt.c ipft_sn.c ipft_ef.c ipft_td.c ipft_pc.c opt.c ipft_tx.c misc.c ip_frag.c ip_state.c ip_nat.c ipft_hx.c ipt.h snoop.h'
|
||||
src='ipt.c ipft_sn.c ipft_ef.c ipft_td.c ipft_pc.c ipft_tx.c misc.c ip_frag.c ip_state.c ip_nat.c ipft_hx.c ipt.h snoop.h'
|
||||
|
||||
pax -rvw $src test $d/src/usr.sbin/ipf/ipftest
|
||||
|
||||
@ -127,7 +127,7 @@ cd $d/src/usr.sbin/ipf/ipftest
|
||||
|
||||
echo creating Makefile
|
||||
cat > Makefile<<'__eof_makefile'
|
||||
# $NetBSD: ipfilter2netbsd,v 1.5 1997/04/13 18:42:20 veego Exp $
|
||||
# $NetBSD: ipfilter2netbsd,v 1.1 1997/05/04 15:10:36 mrg Exp $
|
||||
|
||||
PROG= ipftest
|
||||
SRCS= ipt.c ipft_sn.c ipft_ef.c ipft_td.c ipft_pc.c opt.c ipft_tx.c misc.c ip_frag.c ip_state.c ip_nat.c ipft_hx.c ip_fil.c fil.c parse.c
|
||||
@ -152,7 +152,7 @@ cd $d/src/usr.sbin/ipf/ipmon
|
||||
|
||||
echo creating Makefile
|
||||
cat > Makefile<<'__eof_makefile'
|
||||
# $NetBSD: ipfilter2netbsd,v 1.5 1997/04/13 18:42:20 veego Exp $
|
||||
# $NetBSD: ipfilter2netbsd,v 1.1 1997/05/04 15:10:36 mrg Exp $
|
||||
|
||||
PROG= ipmon
|
||||
MAN= ipmon.8
|
||||
@ -177,7 +177,7 @@ mv ipnat.1 ipnat.8
|
||||
|
||||
echo creating Makefile
|
||||
cat > Makefile<<'__eof_makefile'
|
||||
# $NetBSD: ipfilter2netbsd,v 1.5 1997/04/13 18:42:20 veego Exp $
|
||||
# $NetBSD: ipfilter2netbsd,v 1.1 1997/05/04 15:10:36 mrg Exp $
|
||||
|
||||
PROG= ipnat
|
||||
SRCS= kmem.c ipnat.c
|
||||
@ -200,7 +200,7 @@ cd $d/src/usr.sbin/ipf/ipresend
|
||||
|
||||
echo creating Makefile
|
||||
cat > Makefile<<'__eof_makefile'
|
||||
# $NetBSD: ipfilter2netbsd,v 1.5 1997/04/13 18:42:20 veego Exp $
|
||||
# $NetBSD: ipfilter2netbsd,v 1.1 1997/05/04 15:10:36 mrg Exp $
|
||||
|
||||
PROG= ipresend
|
||||
SRCS= ipresend.c ip.c resend.c opt.c ipft_ef.c ipft_hx.c ipft_sn.c ipft_td.c ipft_tx.c sbpf.c 44arp.c
|
||||
@ -223,7 +223,7 @@ cd $d/src/usr.sbin/ipf/ipsend
|
||||
|
||||
echo creating Makefile
|
||||
cat > Makefile<<'__eof_makefile'
|
||||
# $NetBSD: ipfilter2netbsd,v 1.5 1997/04/13 18:42:20 veego Exp $
|
||||
# $NetBSD: ipfilter2netbsd,v 1.1 1997/05/04 15:10:36 mrg Exp $
|
||||
|
||||
PROG= ipsend
|
||||
SRCS= ipsend.c ip.c ipsopt.c 44arp.c sbpf.c
|
||||
@ -246,7 +246,7 @@ cd $d/src/usr.sbin/ipf/iptest
|
||||
|
||||
echo creating Makefile
|
||||
cat > Makefile<<'__eof_makefile'
|
||||
# $NetBSD: ipfilter2netbsd,v 1.5 1997/04/13 18:42:20 veego Exp $
|
||||
# $NetBSD: ipfilter2netbsd,v 1.1 1997/05/04 15:10:36 mrg Exp $
|
||||
|
||||
PROG= iptest
|
||||
SRCS= iptest.c iptests.c ip.c sbpf.c 44arp.c sock.c
|
||||
@ -277,7 +277,7 @@ cd $d/src/sys/lkm/netinet/if_ipl
|
||||
|
||||
echo creating Makefile
|
||||
cat > Makefile<<'__eof_makefile'
|
||||
# $NetBSD: ipfilter2netbsd,v 1.5 1997/04/13 18:42:20 veego Exp $
|
||||
# $NetBSD: ipfilter2netbsd,v 1.1 1997/05/04 15:10:36 mrg Exp $
|
||||
|
||||
.include "../Makefile.inc"
|
||||
|
||||
@ -301,7 +301,7 @@ find $d -name '*.[ch]' -print | while read c; do
|
||||
< $c > /tmp/ipf2n$$ && mv /tmp/ipf2n$$ $c && echo transformed $c
|
||||
sed 1q < $c | grep '\$NetBSD' || (
|
||||
cat <<'__eof_header'
|
||||
/* $NetBSD: ipfilter2netbsd,v 1.5 1997/04/13 18:42:20 veego Exp $ */
|
||||
/* $NetBSD: ipfilter2netbsd,v 1.1 1997/05/04 15:10:36 mrg Exp $ */
|
||||
|
||||
__eof_header
|
||||
cat $c
|
@ -1,134 +0,0 @@
|
||||
/*
|
||||
* (C)opyright 1993,1994,1995 by Darren Reed.
|
||||
*
|
||||
* 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 <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_var.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/tcpip.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/ip_compat.h>
|
||||
#include "ipf.h"
|
||||
|
||||
#if !defined(lint) && defined(LIBC_SCCS)
|
||||
static char sccsid[] = "@(#)opt.c 1.8 4/10/96 (C) 1993-1995 Darren Reed";
|
||||
static char rcsid[] = "$Id: opt.c,v 1.1.1.1 1997/01/05 13:09:04 mrg Exp $";
|
||||
#endif
|
||||
|
||||
extern int opts;
|
||||
|
||||
struct ipopt_names ionames[] ={
|
||||
{ IPOPT_NOP, 0x000001, 1, "nop" },
|
||||
{ IPOPT_RR, 0x000002, 7, "rr" }, /* 1 route */
|
||||
{ IPOPT_ZSU, 0x000004, 3, "zsu" },
|
||||
{ IPOPT_MTUP, 0x000008, 3, "mtup" },
|
||||
{ IPOPT_MTUR, 0x000010, 3, "mtur" },
|
||||
{ IPOPT_ENCODE, 0x000020, 3, "encode" },
|
||||
{ IPOPT_TS, 0x000040, 8, "ts" }, /* 1 TS */
|
||||
{ IPOPT_TR, 0x000080, 3, "tr" },
|
||||
{ IPOPT_SECURITY,0x000100, 11, "sec" },
|
||||
{ IPOPT_SECURITY,0x000100, 11, "sec-class" },
|
||||
{ IPOPT_LSRR, 0x000200, 7, "lsrr" }, /* 1 route */
|
||||
{ IPOPT_E_SEC, 0x000400, 3, "e-sec" },
|
||||
{ IPOPT_CIPSO, 0x000800, 3, "cipso" },
|
||||
{ IPOPT_SATID, 0x001000, 4, "satid" },
|
||||
{ IPOPT_SSRR, 0x002000, 7, "ssrr" }, /* 1 route */
|
||||
{ IPOPT_ADDEXT, 0x004000, 3, "addext" },
|
||||
{ IPOPT_VISA, 0x008000, 3, "visa" },
|
||||
{ IPOPT_IMITD, 0x010000, 3, "imitd" },
|
||||
{ IPOPT_EIP, 0x020000, 3, "eip" },
|
||||
{ IPOPT_FINN, 0x040000, 3, "finn" },
|
||||
{ 0, 0, 0, (char *)NULL } /* must be last */
|
||||
};
|
||||
|
||||
struct ipopt_names secclass[] = {
|
||||
{ IPSO_CLASS_RES4, 0x01, 0, "reserv-4" },
|
||||
{ IPSO_CLASS_TOPS, 0x02, 0, "topsecret" },
|
||||
{ IPSO_CLASS_SECR, 0x04, 0, "secret" },
|
||||
{ IPSO_CLASS_RES3, 0x08, 0, "reserv-3" },
|
||||
{ IPSO_CLASS_CONF, 0x10, 0, "confid" },
|
||||
{ IPSO_CLASS_UNCL, 0x20, 0, "unclass" },
|
||||
{ IPSO_CLASS_RES2, 0x40, 0, "reserv-2" },
|
||||
{ IPSO_CLASS_RES1, 0x80, 0, "reserv-1" },
|
||||
{ 0, 0, 0, NULL } /* must be last */
|
||||
};
|
||||
|
||||
|
||||
static u_char seclevel(slevel)
|
||||
char *slevel;
|
||||
{
|
||||
struct ipopt_names *so;
|
||||
|
||||
for (so = secclass; so->on_name; so++)
|
||||
if (!strcasecmp(slevel, so->on_name))
|
||||
break;
|
||||
|
||||
if (!so->on_name) {
|
||||
fprintf(stderr, "no such security level: %s\n", slevel);
|
||||
return 0;
|
||||
}
|
||||
return (u_char)so->on_value;
|
||||
}
|
||||
|
||||
|
||||
u_long buildopts(cp, op)
|
||||
char *cp, *op;
|
||||
{
|
||||
struct ipopt_names *io;
|
||||
u_char lvl;
|
||||
u_long msk = 0;
|
||||
char *s, *t;
|
||||
int len = 0;
|
||||
|
||||
for (s = strtok(cp, ","); s; s = strtok(NULL, ",")) {
|
||||
if ((t = strchr(s, '=')))
|
||||
*t++ = '\0';
|
||||
for (io = ionames; io->on_name; io++) {
|
||||
if (strcasecmp(s, io->on_name) || (msk & io->on_bit))
|
||||
continue;
|
||||
if ((len + io->on_siz) > 48) {
|
||||
fprintf(stderr, "options too long\n");
|
||||
return 0;
|
||||
}
|
||||
len += io->on_siz;
|
||||
*op++ = io->on_value;
|
||||
if (io->on_siz > 1) {
|
||||
*op++ = io->on_siz;
|
||||
*op++ = IPOPT_MINOFF;
|
||||
|
||||
if (t && !strcasecmp(s, "sec-class")) {
|
||||
lvl = seclevel(t);
|
||||
*(op - 1) = lvl;
|
||||
}
|
||||
op += io->on_siz - 3;
|
||||
if (len & 3) {
|
||||
*op++ = IPOPT_NOP;
|
||||
len++;
|
||||
}
|
||||
}
|
||||
if (opts & OPT_DEBUG)
|
||||
fprintf(stderr, "bo: %s %d %#x: %d\n",
|
||||
io->on_name, io->on_value,
|
||||
io->on_bit, len);
|
||||
msk |= io->on_bit;
|
||||
break;
|
||||
}
|
||||
if (!io->on_name) {
|
||||
fprintf(stderr, "unknown IP option name %s\n", s);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
*op++ = IPOPT_EOL;
|
||||
len++;
|
||||
return len;
|
||||
}
|
@ -1,137 +0,0 @@
|
||||
/* $NetBSD: opt.c,v 1.1.1.1 1997/03/29 02:49:50 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* (C)opyright 1993,1994,1995 by Darren Reed.
|
||||
*
|
||||
* 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 <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_var.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/tcpip.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/ip_compat.h>
|
||||
#include "ipf.h"
|
||||
|
||||
#if !defined(lint) && defined(LIBC_SCCS)
|
||||
static char sccsid[] = "@(#)opt.c 1.8 4/10/96 (C) 1993-1995 Darren Reed";
|
||||
static char rcsid[] = "$Id: opt.c,v 1.1.1.1 1997/03/29 02:49:50 darrenr Exp $";
|
||||
#endif
|
||||
|
||||
extern int opts;
|
||||
|
||||
struct ipopt_names ionames[] ={
|
||||
{ IPOPT_NOP, 0x000001, 1, "nop" },
|
||||
{ IPOPT_RR, 0x000002, 7, "rr" }, /* 1 route */
|
||||
{ IPOPT_ZSU, 0x000004, 3, "zsu" },
|
||||
{ IPOPT_MTUP, 0x000008, 3, "mtup" },
|
||||
{ IPOPT_MTUR, 0x000010, 3, "mtur" },
|
||||
{ IPOPT_ENCODE, 0x000020, 3, "encode" },
|
||||
{ IPOPT_TS, 0x000040, 8, "ts" }, /* 1 TS */
|
||||
{ IPOPT_TR, 0x000080, 3, "tr" },
|
||||
{ IPOPT_SECURITY,0x000100, 11, "sec" },
|
||||
{ IPOPT_SECURITY,0x000100, 11, "sec-class" },
|
||||
{ IPOPT_LSRR, 0x000200, 7, "lsrr" }, /* 1 route */
|
||||
{ IPOPT_E_SEC, 0x000400, 3, "e-sec" },
|
||||
{ IPOPT_CIPSO, 0x000800, 3, "cipso" },
|
||||
{ IPOPT_SATID, 0x001000, 4, "satid" },
|
||||
{ IPOPT_SSRR, 0x002000, 7, "ssrr" }, /* 1 route */
|
||||
{ IPOPT_ADDEXT, 0x004000, 3, "addext" },
|
||||
{ IPOPT_VISA, 0x008000, 3, "visa" },
|
||||
{ IPOPT_IMITD, 0x010000, 3, "imitd" },
|
||||
{ IPOPT_EIP, 0x020000, 3, "eip" },
|
||||
{ IPOPT_FINN, 0x040000, 3, "finn" },
|
||||
{ 0, 0, 0, (char *)NULL } /* must be last */
|
||||
};
|
||||
|
||||
struct ipopt_names secclass[] = {
|
||||
{ IPSO_CLASS_RES4, 0x01, 0, "reserv-4" },
|
||||
{ IPSO_CLASS_TOPS, 0x02, 0, "topsecret" },
|
||||
{ IPSO_CLASS_SECR, 0x04, 0, "secret" },
|
||||
{ IPSO_CLASS_RES3, 0x08, 0, "reserv-3" },
|
||||
{ IPSO_CLASS_CONF, 0x10, 0, "confid" },
|
||||
{ IPSO_CLASS_UNCL, 0x20, 0, "unclass" },
|
||||
{ IPSO_CLASS_RES2, 0x40, 0, "reserv-2" },
|
||||
{ IPSO_CLASS_RES1, 0x80, 0, "reserv-1" },
|
||||
{ 0, 0, 0, NULL } /* must be last */
|
||||
};
|
||||
|
||||
static u_char seclevel __P((char *));
|
||||
|
||||
static u_char seclevel(slevel)
|
||||
char *slevel;
|
||||
{
|
||||
struct ipopt_names *so;
|
||||
|
||||
for (so = secclass; so->on_name; so++)
|
||||
if (!strcasecmp(slevel, so->on_name))
|
||||
break;
|
||||
|
||||
if (!so->on_name) {
|
||||
fprintf(stderr, "no such security level: %s\n", slevel);
|
||||
return 0;
|
||||
}
|
||||
return (u_char)so->on_value;
|
||||
}
|
||||
|
||||
|
||||
u_long buildopts(cp, op)
|
||||
char *cp, *op;
|
||||
{
|
||||
struct ipopt_names *io;
|
||||
u_char lvl;
|
||||
u_long msk = 0;
|
||||
char *s, *t;
|
||||
int len = 0;
|
||||
|
||||
for (s = strtok(cp, ","); s; s = strtok(NULL, ",")) {
|
||||
if ((t = strchr(s, '=')))
|
||||
*t++ = '\0';
|
||||
for (io = ionames; io->on_name; io++) {
|
||||
if (strcasecmp(s, io->on_name) || (msk & io->on_bit))
|
||||
continue;
|
||||
if ((len + io->on_siz) > 48) {
|
||||
fprintf(stderr, "options too long\n");
|
||||
return 0;
|
||||
}
|
||||
len += io->on_siz;
|
||||
*op++ = io->on_value;
|
||||
if (io->on_siz > 1) {
|
||||
*op++ = io->on_siz;
|
||||
*op++ = IPOPT_MINOFF;
|
||||
|
||||
if (t && !strcasecmp(s, "sec-class")) {
|
||||
lvl = seclevel(t);
|
||||
*(op - 1) = lvl;
|
||||
}
|
||||
op += io->on_siz - 3;
|
||||
if (len & 3) {
|
||||
*op++ = IPOPT_NOP;
|
||||
len++;
|
||||
}
|
||||
}
|
||||
if (opts & OPT_DEBUG)
|
||||
fprintf(stderr, "bo: %s %d %#x: %d\n",
|
||||
io->on_name, io->on_value,
|
||||
io->on_bit, len);
|
||||
msk |= io->on_bit;
|
||||
break;
|
||||
}
|
||||
if (!io->on_name) {
|
||||
fprintf(stderr, "unknown IP option name %s\n", s);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
*op++ = IPOPT_EOL;
|
||||
len++;
|
||||
return len;
|
||||
}
|
Loading…
Reference in New Issue
Block a user