Import IPFilter 5.1.2
This commit is contained in:
parent
28b444bcec
commit
c9d5dc6c77
2
external/bsd/ipf/dist/FWTK/ftp-gw.diff
vendored
2
external/bsd/ipf/dist/FWTK/ftp-gw.diff
vendored
@ -4,7 +4,7 @@
|
||||
*** 11,31 ****
|
||||
--- 11,41 ----
|
||||
*/
|
||||
static char RcsId[] = "Header";
|
||||
static char RcsId[] = "$Header: /cvsroot/src/external/bsd/ipf/dist/FWTK/ftp-gw.diff,v 1.1.1.2 2012/07/22 13:44:27 darrenr Exp $";
|
||||
|
||||
+ /*
|
||||
+ * Patches for IP Filter NAT extensions written by Darren Reed, 7/7/96
|
||||
|
@ -124,7 +124,7 @@ diff -cr ../TIS.orig/fwtk/Makefile.config.solaris fwtk/Makefile.config.solaris
|
||||
***************
|
||||
*** 11,30 ****
|
||||
#
|
||||
# RcsId: "Header"
|
||||
# RcsId: "$Header: /cvsroot/src/external/bsd/ipf/dist/FWTK/fwtk_transparent.diff,v 1.1.1.2 2012/07/22 13:44:27 darrenr Exp $"
|
||||
|
||||
|
||||
# Your C compiler (eg, "cc" or "gcc")
|
||||
@ -145,7 +145,7 @@ diff -cr ../TIS.orig/fwtk/Makefile.config.solaris fwtk/Makefile.config.solaris
|
||||
-Dgethostbyaddr=res_gethostbyaddr -Dgetnetbyname=res_getnetbyname \
|
||||
--- 11,34 ----
|
||||
#
|
||||
# RcsId: "Header"
|
||||
# RcsId: "$Header: /cvsroot/src/external/bsd/ipf/dist/FWTK/fwtk_transparent.diff,v 1.1.1.2 2012/07/22 13:44:27 darrenr Exp $"
|
||||
|
||||
+ #
|
||||
+ # Path to sources of ip_filter (ip_nat.h required in lib/hnam.c)
|
||||
|
259
external/bsd/ipf/dist/HISTORY
vendored
259
external/bsd/ipf/dist/HISTORY
vendored
@ -10,6 +10,265 @@
|
||||
# and especially those who have found the time to port IP Filter to new
|
||||
# platforms.
|
||||
#
|
||||
5.1.2 - RELEASED - 22 Jul 2012
|
||||
|
||||
3546266 macro letters could be more consistent
|
||||
3546265 not all of the state statistics are displayed
|
||||
3546261 scripts for updating BSD environment out of date
|
||||
3546260 compiler warnings about non-integer array subscript
|
||||
3546259 asserting numdereflists == 0 is not correct
|
||||
3546258 expression matching does not see IPF_EXP_END
|
||||
3544317 ipnat/ipfstat are not using ipfexp_t
|
||||
3545324 proxy checksum calculation is not hardware aware
|
||||
3545321 FTP sequence number adjustment incorrectly applied
|
||||
3545320 EPSV is not recognised
|
||||
3545319 move nat rule creation to ip_proxy.c
|
||||
3545317 better feedback of checksum requirements for proxies
|
||||
3545314 ftp proxy levels do not make sense
|
||||
3545312 EPRT is not supported by ftp proxy
|
||||
3544318 ipnat.conf parsing ignores LHS address family
|
||||
3545309 non-ipv6 safe proxies do not fail with ipv6
|
||||
3545323 NAT updates the source port twice
|
||||
3545322 ipv6 nat rules cannot start proxies
|
||||
3544314 bucket copyout tries to copy too much data
|
||||
3544313 remove nat encap feature
|
||||
3546248 compat rule pointer type mismatch
|
||||
3546247 UDP hardware checksum offload not recognised
|
||||
3545311 ifp_ifaddr does not find the first set address
|
||||
3545310 ipmon needs ipl_sec on 64bit boundary
|
||||
3545326 reference count changes made without lock
|
||||
3544315 stateful matching does not use ipfexp_t
|
||||
3543493 tokens are not flushed when disabled
|
||||
3543487 NAT rules do not always release lookup objects
|
||||
3543491 function comments in ip_state.c are old
|
||||
3543404 ipnat.conf parsing uses family/ip version badly
|
||||
3543403 incorrect line number printed in ipnat parsing errors
|
||||
3543402 Not all NAT statistics are printed
|
||||
3542979 NAT session list management is too simple
|
||||
3542978 ipv4 and ipv6 nat insert have common hash insertion
|
||||
3542977 ipnat_t refence tracking incomplete
|
||||
3542975 proxies must use ipnat_t separately
|
||||
3542980 printing ipv6 expressions is wrong
|
||||
3542983 ippool cannot handle more than one ipv6 address
|
||||
3543018 mask array shifted incorrectly.
|
||||
3542974 reason for dropping packet is lost
|
||||
3542982 line numbers not recorded/displayed correctly by ipf
|
||||
3542981 exclamation mark cuases trouble with pools
|
||||
3541655 test suite checksums incorrect
|
||||
3541653 display proxy fail status correctly
|
||||
3540993 IP header offset excluded in pullup calculations
|
||||
3540994 pullupmsg does not work as required
|
||||
3540992 pointer to ipv6 frag header not updated on pullup
|
||||
3541645 netmask management adds /32 for /0
|
||||
3541637 ipnat parser does not zero port fields for non-port protocol
|
||||
3541635 pool names cannot by numbers
|
||||
3540995 IPv6 fragment tracking does not always work
|
||||
3540996 printing of nextip for ipv6 nat rules is wrong
|
||||
3540999 ipnat.conf parsing has trouble with icmpidmap for ipv6
|
||||
3540825 whois output parsing error for ipv6
|
||||
3540814 ipfd_lock serves no purpose
|
||||
3540810 lookup objects need tail pointers
|
||||
3540809 refactor hash table lookups for nat
|
||||
3540819 radix tree does not work with ipv6
|
||||
3540820 mutex emulation should be logged
|
||||
3540828 ipfstat filtering with -m fails tests
|
||||
3536480 ippool could be more like the others
|
||||
3536477 pool printing not uniform
|
||||
3536483 flushing empty destination lists causes panic
|
||||
3536481 more use of bzero after KMALLOC required
|
||||
3536479 ipnat.conf line numbers not stored
|
||||
3536484 Makefile missing dependency for ippool
|
||||
3536199 TFTP proxy requires something extra
|
||||
3536198 ICMP checksum out by one
|
||||
3536203 ipnat does not return an error
|
||||
3536201 ipf.conf parsing too address friendly
|
||||
3536200 printing of bytes/packets not indented
|
||||
3497941 ipv4 multicast detection incorrect on little endian
|
||||
3535361 to interfaces printed out of order
|
||||
3535363 ipf parser is inconsistent
|
||||
3532306 deleting ipnat rules does not work
|
||||
3532054 new error required for ipf_rx_create
|
||||
3532053 icmp6 checksums wrong
|
||||
3532052 icmpv6 state check with incorrect length
|
||||
3531871 checksum verification wants too many icmp6 bytes
|
||||
3531870 ipnat.conf parsing needs to support inet6
|
||||
3532048 error in ipf group parsing
|
||||
3531868 ICMPV6 checksum not validated
|
||||
3531893 ipftest exits without error for bad input
|
||||
3531890 whois pool parsing builds bad structures
|
||||
3531891 icmpv6 text parsing ignorant of icmp types
|
||||
3531653 rewrite with icmp does not work
|
||||
3530563 NAT operations fail with EPERM
|
||||
3530544 first pass at gcc -Wextra cleanup
|
||||
3530540 lookup create functions do not set error properly
|
||||
3530539 ipf_main_soft_destroy doesn't need 2nd arg
|
||||
3530541 reorder structure for better packing
|
||||
3530543 ipnat purge needs documentation
|
||||
3530515 BSD upgrade script required
|
||||
3528029 ipmon bad-mutex panic
|
||||
3530247 loading address pools light on input validation
|
||||
3530255 radix tree delete uses wrong lookup
|
||||
3530254 radix tree allocation support wrong
|
||||
3530264 ipmon prints qd for some 64bit numbers
|
||||
3530260 decapsulate rules not printed correctly.
|
||||
3530266 ipfstat -v/-d flags confused
|
||||
2939220 why a packet is blocked is not discernable
|
||||
2939218 output interface not recorded
|
||||
2941850 use of destination lists with to/dup-to beneficial
|
||||
3457747 build errors introduced with radix change
|
||||
3535360 timeout groups leak
|
||||
3535359 memory leak with tokens
|
||||
3535358 listing rules in groups requires tracking groups
|
||||
3535357 rule head removal is problematic
|
||||
3530259 not all ioctl error checked wth SIOCIPFINTERROR
|
||||
3530258 error routine that uses fd required
|
||||
3530253 inadequate function comment blocks
|
||||
3530249 walking lookup tables leaks memory
|
||||
3530241 extra lock padding required for freebsd
|
||||
3529901 ipf returns 0 when rules fail to load
|
||||
3529491 checksum validation could be better
|
||||
3529486 tcp checksum wrong for ipv6
|
||||
3533779 ipv6 nat rules missing inet6 keyword
|
||||
3532693 ipnat.conf rejects some ipv6 addresses
|
||||
3532691 ipv4 should not be forced for icmp
|
||||
3532689 ipv6 nat rules do not print inet6
|
||||
3532688 ipv6 address always printed with "to <if>"
|
||||
3532687 with v6hdrs not supported like with ipopts
|
||||
3532686 ipf expressions do not work with ipv6
|
||||
3540825 whois output parsing error for ipv6
|
||||
3540818 NAT for certain IPv6 ICMP packets should not be allowed
|
||||
3540815 memory leak with destination lists
|
||||
3540814 ipfd_lock serves no purpose
|
||||
3540810 lookup objects need tail pointers
|
||||
3540809 refactor hash table lookups for nat
|
||||
3540808 completed tokens do not stop iteration
|
||||
3530492 address hash table name not used
|
||||
3528029 ipmon bad-mutex panic
|
||||
3530256 hook memory leaked
|
||||
3530271 pools parsing produces badly formed address structures
|
||||
3488061 cleanup for illumos build
|
||||
3484434 SIOCIPFINTERROR must work for all devices
|
||||
3484067 mandoc -Tlint warnings to be fixed
|
||||
3483343 compile warning in ipfcomp.c
|
||||
3482893 building without IPFILTER_LOG fails
|
||||
3482765 building netbsd kernel without inet6 fails
|
||||
3482116 ipf_check frees packet from ipftest
|
||||
3481663 does not compile on solaris 11
|
||||
|
||||
5.1.1 - RELEASED - 9 May 2012
|
||||
|
||||
3481322 ip_fil_compat.c needs a cleanup
|
||||
3481211 add user errors to dtrace
|
||||
3481152 compatibility for 4.1 needs more work
|
||||
3481153 PRIu64 problems on FreeBSD
|
||||
3481155 ipnat listing incorrect
|
||||
3480543 change leads to compat problems
|
||||
3480538 compiler errors from earlier patch
|
||||
3480537 ipf_instance_destroy is incomplete
|
||||
3480536 _fini order leads to panic
|
||||
3479991 compiler warnings about size mismatches
|
||||
3479974 copyright dates are wrong (fix)
|
||||
3479464 add support for leaks testing
|
||||
3479457 %qu is not the prefered way
|
||||
3479451 iterators leak memory
|
||||
3479453 nat rules with pools leak
|
||||
3479454 memory leak in hostmap table
|
||||
3479461 load_hash uses memory after free
|
||||
3479462 printpool leaks memory
|
||||
3479452 missing FREE_MB_T to freembt leaks
|
||||
3479450 ipfdetach is called when detached
|
||||
3479448 group mapping rules memory leak
|
||||
3479455 memory leak from tuning
|
||||
3479458 ipf must be running in global zone
|
||||
3479460 driver replace is wrong
|
||||
3479459 radix tree tries to free null pointer
|
||||
3479463 rwlock emulation does not free memory
|
||||
3479465 parser leaks memory
|
||||
3475959 hardware checksum not correctly used
|
||||
3475426 ip pseudo checksum wrong
|
||||
3473566 radix tree does not delete dups right
|
||||
3472987 compile is not clean
|
||||
3472337 not everything is zero'd
|
||||
3472344 interface setup needs to be after insert
|
||||
3472340 wildcard counter drops twice
|
||||
3472338 change fastroute interface
|
||||
3472335 kernel lock defines not placed correctly
|
||||
3472324 ICMP INFOREQ/REPLY not handled
|
||||
3472330 multicast packets tagged by address
|
||||
3472333 ipf_deliverlocal called incorrectly
|
||||
3472345 mutex debug could be more granular
|
||||
3472761 building i19 regression is flawed
|
||||
3456457 use of bsd tree.h needs to be removed
|
||||
3460522 code cleanup required for building on freebsd
|
||||
3459734 trade some cpu for memory
|
||||
3457747 build errors introduced with radix change
|
||||
3457804 build errors from removal of pcap-int,h
|
||||
3440163 rewrite radix tree
|
||||
3428004 snoop, tcpdump, etherfind readers are unused
|
||||
3439495 ipf_rand_push never called (fix brackets)
|
||||
3437732 getnattype does not need to use ipnat_t (fix variable name)
|
||||
3437696 fr_cksum is a nightmare
|
||||
3439061 ipf_send_ip doesn't need 3rd arg
|
||||
3439059 ipid needs to be file local
|
||||
3437740 complete buildout of fnew
|
||||
3438575 add dtrace probes to block events
|
||||
3438347 comment blocks missing softc
|
||||
3437687 description of ipf_makefrip wrong
|
||||
3438340 more stats as dtrace probes
|
||||
3438316 free on nat structure uses fixed size
|
||||
3437745 nat iterator using the wrong size
|
||||
3437710 fail checksum verification if packet is short
|
||||
3437696 fr_cksum is a nightmare
|
||||
3437732 getnattype does not need to use ipnat_t
|
||||
3437735 rename ipf_allocmbt to allocmbt
|
||||
3437697 fr_family to version assignment is wrong
|
||||
3437746 ap_session_t has unused fields
|
||||
3437747 move softc structure to .h file (ip_state.c)
|
||||
3437704 there is no DTRACE_PROBE5
|
||||
3437748 wrong interface in qpktinfo_t
|
||||
3437729 create function to hexdump mb_t
|
||||
3438273 msgdsize should be easier to read
|
||||
3437683 object direction not set for 32bit
|
||||
3433767 calling ip_cksum could be easier
|
||||
3433764 left over locking
|
||||
3428015 printing proxy data size is useless
|
||||
3428013 add M_ADJ to hide adjmsg/m_adj
|
||||
3428012 interface name is not always returned correctly
|
||||
3428002 ip_ttl is too low
|
||||
3427997 ipft readers do not set buffer length
|
||||
3426558 resistence is futile
|
||||
3424495 various copy-paste errors
|
||||
1826936 shall we allow ipf to be as dumb as its admin
|
||||
3424477 specfuncs needs to go
|
||||
3424484 missing fr_checkv6sum
|
||||
3424478 one entry at a time
|
||||
2998760 auth rules do not mix well with to/dup-to/fastroute
|
||||
3424195 add ctfmerge to sunos5 makefile
|
||||
3424132 some dtrace probes to start with
|
||||
3423812 makefile needs ip_frag.h for some files
|
||||
3423817 reference count useful in verbose output
|
||||
3423800 walking lists does not drop reference
|
||||
3423805 fragmentation stats not reported correclty
|
||||
3423808 ip addresses reportied incorrectly with ipfstat -f
|
||||
3423821 track packets and bytes for fragmentation
|
||||
3423803 attempt to double free rule
|
||||
3423805 fragmentation stats not reported correctly
|
||||
3422712 system panic with ipfstat -f
|
||||
3422619 pullup counter bumped for every packet
|
||||
3422608 dummy rtentry required to build
|
||||
3422018 frflush next to ipf_fini_all is redundant
|
||||
3422012 instance cleanup is not clean
|
||||
3421845 instance name not set
|
||||
3005622 ip_fil5.1.0 does not load on Solaris 10 U8
|
||||
2976332 stateful filtering is incompatible with ipv4 options
|
||||
3387509 ipftest needs help construction ip packets with options
|
||||
2998746 passp can never be null
|
||||
3064034 mbuf clobbering problem with ipv6
|
||||
3105725 ipnat divide by zero panic
|
||||
2998750 ipf_htent_insert can leak memory
|
||||
3064034 mbuf clobbering problem with ipv6
|
||||
3105725 ipnat divie by zero panic
|
||||
|
||||
5.1 - RELEASED - 9 May 2010
|
||||
|
||||
* See WhatsNew50.txt
|
||||
|
9
external/bsd/ipf/dist/ip_dns_pxy.c
vendored
9
external/bsd/ipf/dist/ip_dns_pxy.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: ip_dns_pxy.c,v 1.1.1.1 2012/03/23 21:19:53 christos Exp $ */
|
||||
/* $NetBSD: ip_dns_pxy.c,v 1.1.1.2 2012/07/22 13:44:11 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id: ip_dns_pxy.c,v 1.1.2.8 2012/01/29 05:30:35 darren_r Exp
|
||||
* $Id: ip_dns_pxy.c,v 1.1.1.2 2012/07/22 13:44:11 darrenr Exp $
|
||||
*/
|
||||
|
||||
#define IPF_DNS_PROXY
|
||||
@ -185,6 +185,9 @@ ipf_p_dns_new(arg, fin, aps, nat)
|
||||
dnsinfo_t *di;
|
||||
int dlen;
|
||||
|
||||
if (fin->fin_v != 4)
|
||||
return -1;
|
||||
|
||||
dlen = fin->fin_dlen - sizeof(udphdr_t);
|
||||
if (dlen < sizeof(ipf_dns_hdr_t)) {
|
||||
/*
|
||||
|
253
external/bsd/ipf/dist/ip_dstlist.c
vendored
253
external/bsd/ipf/dist/ip_dstlist.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ip_dstlist.c,v 1.1.1.1 2012/03/23 21:19:53 christos Exp $ */
|
||||
/* $NetBSD: ip_dstlist.c,v 1.1.1.2 2012/07/22 13:44:12 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
@ -73,11 +73,12 @@ struct file;
|
||||
#endif
|
||||
|
||||
#if !defined(lint)
|
||||
static const char rcsid[] = "@(#)Id: ip_dstlist.c,v 1.13.2.7 2012/01/29 05:30:35 darren_r Exp ";
|
||||
static const char rcsid[] = "@(#)$Id: ip_dstlist.c,v 1.1.1.2 2012/07/22 13:44:12 darrenr Exp $";
|
||||
#endif
|
||||
|
||||
typedef struct ipf_dstl_softc_s {
|
||||
ippool_dst_t *dstlist[LOOKUP_POOL_SZ];
|
||||
ippool_dst_t **tails[LOOKUP_POOL_SZ];
|
||||
ipf_dstl_stat_t stats;
|
||||
} ipf_dstl_softc_t;
|
||||
|
||||
@ -106,6 +107,7 @@ static int ipf_dstlist_table_del __P((ipf_main_softc_t *, void *,
|
||||
iplookupop_t *));
|
||||
static int ipf_dstlist_table_deref __P((ipf_main_softc_t *, void *, void *));
|
||||
static void *ipf_dstlist_table_find __P((void *, int, char *));
|
||||
static void ipf_dstlist_table_free __P((ipf_dstl_softc_t *, ippool_dst_t *));
|
||||
static void ipf_dstlist_table_remove __P((ipf_main_softc_t *,
|
||||
ipf_dstl_softc_t *, ippool_dst_t *));
|
||||
static void ipf_dstlist_table_clearnodes __P((ipf_dstl_softc_t *,
|
||||
@ -154,12 +156,17 @@ ipf_dstlist_soft_create(softc)
|
||||
ipf_main_softc_t *softc;
|
||||
{
|
||||
ipf_dstl_softc_t *softd;
|
||||
int i;
|
||||
|
||||
KMALLOC(softd, ipf_dstl_softc_t *);
|
||||
if (softd == NULL)
|
||||
if (softd == NULL) {
|
||||
IPFERROR(120028);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bzero((char *)softd, sizeof(*softd));
|
||||
for (i = 0; i <= IPL_LOGMAX; i++)
|
||||
softd->tails[i] = &softd->dstlist[i];
|
||||
|
||||
return softd;
|
||||
}
|
||||
@ -218,10 +225,12 @@ ipf_dstlist_soft_fini(softc, arg)
|
||||
ipf_dstl_softc_t *softd = arg;
|
||||
int i;
|
||||
|
||||
for (i = -1; i <= IPL_LOGMAX; i++)
|
||||
while (softd->dstlist[i + 1] != NULL)
|
||||
for (i = -1; i <= IPL_LOGMAX; i++) {
|
||||
while (softd->dstlist[i + 1] != NULL) {
|
||||
ipf_dstlist_table_remove(softc, softd,
|
||||
softd->dstlist[i + 1]);
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT(softd->stats.ipls_numderefnodes == 0);
|
||||
}
|
||||
@ -237,7 +246,10 @@ ipf_dstlist_soft_fini(softc, arg)
|
||||
/* arg4(I) - pointer to local context to use */
|
||||
/* */
|
||||
/* There is currently no such thing as searching a destination list for an */
|
||||
/* address so this function becomes a no-op. */
|
||||
/* address so this function becomes a no-op. Its presence is required as */
|
||||
/* ipf_lookup_res_name() stores the "addr_find" function pointer in the */
|
||||
/* pointer passed in to it as funcptr, although it could be a generic null- */
|
||||
/* op function rather than a specific one. */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
@ -300,6 +312,9 @@ ipf_dstlist_flush(softc, arg, fop)
|
||||
/* unit(I) - device we are working with */
|
||||
/* data(I) - address of object in kernel space */
|
||||
/* */
|
||||
/* This function is called when the iteration token is being free'd and is */
|
||||
/* responsible for dropping the reference count of the structure it points */
|
||||
/* to. */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
static int
|
||||
ipf_dstlist_iter_deref(softc, arg, otype, unit, data)
|
||||
@ -341,6 +356,9 @@ ipf_dstlist_iter_deref(softc, arg, otype, unit, data)
|
||||
/* op(I) - pointer to lookup operation data */
|
||||
/* uid(I) - uid of process doing the ioctl */
|
||||
/* */
|
||||
/* This function is responsible for either selecting the next destination */
|
||||
/* list or node on a destination list to be returned as a user process */
|
||||
/* iterates through the list of destination lists or nodes. */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
static int
|
||||
ipf_dstlist_iter_next(softc, arg, token, iter)
|
||||
@ -350,54 +368,64 @@ ipf_dstlist_iter_next(softc, arg, token, iter)
|
||||
ipflookupiter_t *iter;
|
||||
{
|
||||
ipf_dstnode_t zn, *nextnode = NULL, *node = NULL;
|
||||
ippool_dst_t zero, *next = NULL, *list = NULL;
|
||||
ippool_dst_t zero, *next = NULL, *dsttab = NULL;
|
||||
ipf_dstl_softc_t *softd = arg;
|
||||
int err = 0;
|
||||
void *hint;
|
||||
|
||||
switch (iter->ili_otype)
|
||||
{
|
||||
case IPFLOOKUPITER_LIST :
|
||||
list = token->ipt_data;
|
||||
if (list == NULL) {
|
||||
dsttab = token->ipt_data;
|
||||
if (dsttab == NULL) {
|
||||
next = softd->dstlist[(int)iter->ili_unit + 1];
|
||||
} else {
|
||||
next = list->ipld_next;
|
||||
next = dsttab->ipld_next;
|
||||
}
|
||||
|
||||
if (next != NULL) {
|
||||
ATOMIC_INC32(list->ipld_ref);
|
||||
ATOMIC_INC32(next->ipld_ref);
|
||||
token->ipt_data = next;
|
||||
hint = next->ipld_next;
|
||||
} else {
|
||||
bzero((char *)&zero, sizeof(zero));
|
||||
next = &zero;
|
||||
token->ipt_data = NULL;
|
||||
hint = NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
case IPFLOOKUPITER_NODE :
|
||||
node = token->ipt_data;
|
||||
if (node == NULL) {
|
||||
list = ipf_dstlist_table_find(arg, iter->ili_unit,
|
||||
iter->ili_name);
|
||||
if (list == NULL) {
|
||||
dsttab = ipf_dstlist_table_find(arg, iter->ili_unit,
|
||||
iter->ili_name);
|
||||
if (dsttab == NULL) {
|
||||
IPFERROR(120004);
|
||||
err = ESRCH;
|
||||
nextnode = NULL;
|
||||
} else {
|
||||
nextnode = *list->ipld_dests;
|
||||
list = NULL;
|
||||
if (dsttab->ipld_dests == NULL)
|
||||
nextnode = NULL;
|
||||
else
|
||||
nextnode = *dsttab->ipld_dests;
|
||||
dsttab = NULL;
|
||||
}
|
||||
} else {
|
||||
nextnode = node->ipfd_next;
|
||||
}
|
||||
|
||||
if (nextnode != NULL) {
|
||||
ATOMIC_INC32(nextnode->ipfd_ref);
|
||||
MUTEX_ENTER(&nextnode->ipfd_lock);
|
||||
nextnode->ipfd_ref++;
|
||||
MUTEX_EXIT(&nextnode->ipfd_lock);
|
||||
token->ipt_data = nextnode;
|
||||
hint = nextnode->ipfd_next;
|
||||
} else {
|
||||
bzero((char *)&zn, sizeof(zn));
|
||||
nextnode = &zn;
|
||||
token->ipt_data = NULL;
|
||||
hint = NULL;
|
||||
}
|
||||
break;
|
||||
default :
|
||||
@ -412,10 +440,8 @@ ipf_dstlist_iter_next(softc, arg, token, iter)
|
||||
switch (iter->ili_otype)
|
||||
{
|
||||
case IPFLOOKUPITER_LIST :
|
||||
if (node != NULL) {
|
||||
ipf_dstlist_table_deref(softc, arg, node);
|
||||
}
|
||||
token->ipt_data = next;
|
||||
if (dsttab != NULL)
|
||||
ipf_dstlist_table_deref(softc, arg, dsttab);
|
||||
err = COPYOUT(next, iter->ili_data, sizeof(*next));
|
||||
if (err != 0) {
|
||||
IPFERROR(120005);
|
||||
@ -424,10 +450,8 @@ ipf_dstlist_iter_next(softc, arg, token, iter)
|
||||
break;
|
||||
|
||||
case IPFLOOKUPITER_NODE :
|
||||
if (node != NULL) {
|
||||
if (node != NULL)
|
||||
ipf_dstlist_node_deref(arg, node);
|
||||
}
|
||||
token->ipt_data = nextnode;
|
||||
err = COPYOUT(nextnode, iter->ili_data, sizeof(*nextnode));
|
||||
if (err != 0) {
|
||||
IPFERROR(120006);
|
||||
@ -436,6 +460,9 @@ ipf_dstlist_iter_next(softc, arg, token, iter)
|
||||
break;
|
||||
}
|
||||
|
||||
if (hint == NULL)
|
||||
ipf_token_mark_complete(token);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -510,17 +537,29 @@ ipf_dstlist_node_add(softc, arg, op, uid)
|
||||
IPFERROR(120008);
|
||||
return ENOMEM;
|
||||
}
|
||||
bzero((char *)node, sizeof(*node) + dest.fd_name);
|
||||
|
||||
bcopy(&dest, &node->ipfd_dest, sizeof(dest));
|
||||
node->ipfd_size = sizeof(*node) + dest.fd_name;
|
||||
|
||||
err = COPYIN((char *)op->iplo_struct + sizeof(dest), node->ipfd_names,
|
||||
dest.fd_name);
|
||||
if (err != 0) {
|
||||
IPFERROR(120017);
|
||||
KFREES(node, node->ipfd_size);
|
||||
return EFAULT;
|
||||
if (dest.fd_name > 0) {
|
||||
/*
|
||||
* fd_name starts out as the length of the string to copy
|
||||
* in (including \0) and ends up being the offset from
|
||||
* fd_names (0).
|
||||
*/
|
||||
err = COPYIN((char *)op->iplo_struct + sizeof(dest),
|
||||
node->ipfd_names, dest.fd_name);
|
||||
if (err != 0) {
|
||||
IPFERROR(120017);
|
||||
KFREES(node, node->ipfd_size);
|
||||
return EFAULT;
|
||||
}
|
||||
node->ipfd_dest.fd_name = 0;
|
||||
} else {
|
||||
node->ipfd_dest.fd_name = -1;
|
||||
}
|
||||
|
||||
if (d->ipld_nodes == d->ipld_maxnodes) {
|
||||
KMALLOCS(nodes, ipf_dstnode_t **,
|
||||
sizeof(*nodes) * (d->ipld_maxnodes + 1));
|
||||
@ -550,17 +589,14 @@ ipf_dstlist_node_add(softc, arg, op, uid)
|
||||
*node->ipfd_pnext = node;
|
||||
|
||||
MUTEX_INIT(&node->ipfd_lock, "ipf dst node lock");
|
||||
node->ipfd_plock = &d->ipld_lock;
|
||||
node->ipfd_next = NULL;
|
||||
node->ipfd_uid = uid;
|
||||
node->ipfd_states = 0;
|
||||
node->ipfd_ref = 1;
|
||||
node->ipfd_syncat = 0;
|
||||
node->ipfd_dest.fd_name = 0;
|
||||
(void) ipf_resolvedest(softc, node->ipfd_names, &node->ipfd_dest,
|
||||
AF_INET);
|
||||
if (node->ipfd_dest.fd_name == 0)
|
||||
(void) ipf_resolvedest(softc, node->ipfd_names,
|
||||
&node->ipfd_dest, AF_INET);
|
||||
#ifdef USE_INET6
|
||||
if (node->ipfd_dest.fd_ptr == (void *)-1)
|
||||
if (node->ipfd_dest.fd_name == 0 &&
|
||||
node->ipfd_dest.fd_ptr == (void *)-1)
|
||||
(void) ipf_resolvedest(softc, node->ipfd_names,
|
||||
&node->ipfd_dest, AF_INET6);
|
||||
#endif
|
||||
@ -574,13 +610,13 @@ ipf_dstlist_node_add(softc, arg, op, uid)
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* Function: ipf_dstlist_node_deref */
|
||||
/* Returns: int - 0 = success, else error */
|
||||
/* Parameters: softc(I) - pointer to soft context main structure */
|
||||
/* arg(I) - pointer to local context to use */
|
||||
/* op(I) - pointer to lookup operation data */
|
||||
/* uid(I) - uid of process doing the ioctl */
|
||||
/* Parameters: arg(I) - pointer to local context to use */
|
||||
/* node(I) - pointer to destionation node to free */
|
||||
/* */
|
||||
/* Dereference the use count by one. If it drops to zero then we can assume */
|
||||
/* that it has been removed from any lists/tables and is ripe for freeing. */
|
||||
/* The pointer to context is required for the purpose of maintaining */
|
||||
/* statistics. */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
static int
|
||||
ipf_dstlist_node_deref(arg, node)
|
||||
@ -590,23 +626,18 @@ ipf_dstlist_node_deref(arg, node)
|
||||
ipf_dstl_softc_t *softd = arg;
|
||||
int ref;
|
||||
|
||||
/*
|
||||
* ipfd_plock points back to the lock in the ippool_dst_t that is
|
||||
* used to synchronise additions/deletions from its node list.
|
||||
*/
|
||||
MUTEX_ENTER(node->ipfd_plock);
|
||||
MUTEX_ENTER(&node->ipfd_lock);
|
||||
ref = --node->ipfd_ref;
|
||||
MUTEX_EXIT(node->ipfd_plock);
|
||||
MUTEX_EXIT(&node->ipfd_lock);
|
||||
|
||||
if (ref > 0)
|
||||
return 0;
|
||||
|
||||
MUTEX_DESTROY(&node->ipfd_lock);
|
||||
|
||||
KFREES(node, node->ipfd_size);
|
||||
|
||||
if ((node->ipfd_flags & IPDST_DELETE) != 0)
|
||||
softd->stats.ipls_numderefnodes--;
|
||||
MUTEX_DESTROY(&node->ipfd_lock);
|
||||
KFREES(node, node->ipfd_size);
|
||||
softd->stats.ipls_numnodes--;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -672,7 +703,6 @@ ipf_dstlist_node_del(softc, arg, op, uid)
|
||||
continue;
|
||||
if (!bcmp(&node->ipfd_dest.fd_ip6, &frd.fd_ip6,
|
||||
size - offsetof(frdest_t, fd_ip6))) {
|
||||
MUTEX_ENTER(&node->ipfd_lock);
|
||||
ipf_dstlist_node_free(softd, d, node);
|
||||
MUTEX_EXIT(&d->ipld_lock);
|
||||
KFREES(temp, size);
|
||||
@ -689,7 +719,9 @@ ipf_dstlist_node_del(softc, arg, op, uid)
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* Function: ipf_dstlist_node_free */
|
||||
/* Returns: Nil */
|
||||
/* Parameters: node(I) - pointer to node to free */
|
||||
/* Parameters: softd(I) - pointer to the destination list context */
|
||||
/* d(I) - pointer to destination list */
|
||||
/* node(I) - pointer to node to free */
|
||||
/* Locks: MUTEX(ipld_lock) or WRITE(ipf_poolrw) */
|
||||
/* */
|
||||
/* Free the destination node by first removing it from any lists and then */
|
||||
@ -704,7 +736,6 @@ ipf_dstlist_node_free(softd, d, node)
|
||||
ippool_dst_t *d;
|
||||
ipf_dstnode_t *node;
|
||||
{
|
||||
int ref;
|
||||
int i;
|
||||
|
||||
/*
|
||||
@ -718,13 +749,6 @@ ipf_dstlist_node_free(softd, d, node)
|
||||
sizeof(*d->ipld_dests) * (d->ipld_nodes - i - 1));
|
||||
}
|
||||
d->ipld_nodes--;
|
||||
/*
|
||||
* ipfd_plock points back to the lock in the ippool_dst_t that is
|
||||
* used to synchronise additions/deletions from its node list.
|
||||
*/
|
||||
MUTEX_ENTER(node->ipfd_plock);
|
||||
|
||||
ref = --node->ipfd_ref;
|
||||
|
||||
if (node->ipfd_pnext != NULL)
|
||||
*node->ipfd_pnext = node->ipfd_next;
|
||||
@ -733,16 +757,12 @@ ipf_dstlist_node_free(softd, d, node)
|
||||
node->ipfd_pnext = NULL;
|
||||
node->ipfd_next = NULL;
|
||||
|
||||
MUTEX_EXIT(node->ipfd_plock);
|
||||
|
||||
if (ref == 0) {
|
||||
MUTEX_DESTROY(&node->ipfd_lock);
|
||||
KFREES(node, node->ipfd_size);
|
||||
softd->stats.ipls_numnodes--;
|
||||
} else if ((node->ipfd_flags & IPDST_DELETE) == 0) {
|
||||
if ((node->ipfd_flags & IPDST_DELETE) == 0) {
|
||||
softd->stats.ipls_numderefnodes++;
|
||||
node->ipfd_flags |= IPDST_DELETE;
|
||||
}
|
||||
|
||||
ipf_dstlist_node_deref(softd, node);
|
||||
}
|
||||
|
||||
|
||||
@ -785,7 +805,7 @@ ipf_dstlist_stats_get(softc, arg, op)
|
||||
op->iplo_name);
|
||||
else
|
||||
ptr = softd->dstlist[unit + 1];
|
||||
stats.ipls_list[unit + 1] = ptr;
|
||||
stats.ipls_list[unit] = ptr;
|
||||
} else {
|
||||
IPFERROR(120024);
|
||||
err = EINVAL;
|
||||
@ -823,27 +843,26 @@ ipf_dstlist_table_add(softc, arg, op)
|
||||
ippool_dst_t user, *d, *new;
|
||||
int unit, err;
|
||||
|
||||
KMALLOC(new, ippool_dst_t *);
|
||||
if (new == NULL) {
|
||||
softd->stats.ipls_nomem++;
|
||||
IPFERROR(120014);
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
d = ipf_dstlist_table_find(arg, op->iplo_unit, op->iplo_name);
|
||||
if (d != NULL) {
|
||||
IPFERROR(120013);
|
||||
KFREE(new);
|
||||
return EEXIST;
|
||||
}
|
||||
|
||||
err = COPYIN(op->iplo_struct, &user, sizeof(user));
|
||||
if (err != 0) {
|
||||
IPFERROR(120021);
|
||||
KFREE(new);
|
||||
return EFAULT;
|
||||
}
|
||||
|
||||
KMALLOC(new, ippool_dst_t *);
|
||||
if (new == NULL) {
|
||||
softd->stats.ipls_nomem++;
|
||||
IPFERROR(120014);
|
||||
return ENOMEM;
|
||||
}
|
||||
bzero((char *)new, sizeof(*new));
|
||||
|
||||
MUTEX_INIT(&new->ipld_lock, "ipf dst table lock");
|
||||
|
||||
strncpy(new->ipld_name, op->iplo_name, FR_GROUPLEN);
|
||||
@ -851,18 +870,11 @@ ipf_dstlist_table_add(softc, arg, op)
|
||||
new->ipld_unit = unit;
|
||||
new->ipld_policy = user.ipld_policy;
|
||||
new->ipld_seed = ipf_random();
|
||||
new->ipld_dests = NULL;
|
||||
new->ipld_nodes = 0;
|
||||
new->ipld_maxnodes = 0;
|
||||
new->ipld_selected = NULL;
|
||||
new->ipld_ref = 0;
|
||||
new->ipld_flags = 0;
|
||||
new->ipld_ref = 1;
|
||||
|
||||
new->ipld_pnext = &softd->dstlist[unit + 1];
|
||||
new->ipld_next = softd->dstlist[unit + 1];
|
||||
if (softd->dstlist[unit + 1] != NULL)
|
||||
softd->dstlist[unit + 1]->ipld_pnext = &new->ipld_next;
|
||||
softd->dstlist[unit + 1] = new;
|
||||
new->ipld_pnext = softd->tails[unit + 1];
|
||||
*softd->tails[unit + 1] = new;
|
||||
softd->tails[unit + 1] = &new->ipld_next;
|
||||
softd->stats.ipls_numlists++;
|
||||
|
||||
return 0;
|
||||
@ -908,13 +920,15 @@ ipf_dstlist_table_del(softc, arg, op)
|
||||
/* Function: ipf_dstlist_table_remove */
|
||||
/* Returns: Nil */
|
||||
/* Parameters: softc(I) - pointer to soft context main structure */
|
||||
/* arg(I) - pointer to local context to use */
|
||||
/* op(I) - pointer to lookup operation data */
|
||||
/* softd(I) - pointer to the destination list context */
|
||||
/* d(I) - pointer to destination list */
|
||||
/* */
|
||||
/* Remove a given destination list from existance. While the IPDST_DELETE */
|
||||
/* flag is set every time we call this function and the reference count is */
|
||||
/* non-zero, the "numdereflists" counter is only incremented when the entry */
|
||||
/* is removed from the list as it only becomes dereferenced once. */
|
||||
/* non-zero, the "numdereflists" counter is always incremented because the */
|
||||
/* decision about whether it will be freed or not is not made here. This */
|
||||
/* means that the only action the code can take here is to treat it as if */
|
||||
/* it will become a detached. */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
static void
|
||||
ipf_dstlist_table_remove(softc, softd, d)
|
||||
@ -923,11 +937,11 @@ ipf_dstlist_table_remove(softc, softd, d)
|
||||
ippool_dst_t *d;
|
||||
{
|
||||
|
||||
if (d->ipld_pnext != NULL) {
|
||||
if (softd->tails[d->ipld_unit + 1] == &d->ipld_next)
|
||||
softd->tails[d->ipld_unit + 1] = d->ipld_pnext;
|
||||
|
||||
if (d->ipld_pnext != NULL)
|
||||
*d->ipld_pnext = d->ipld_next;
|
||||
if (d->ipld_ref > 1)
|
||||
softd->stats.ipls_numdereflists++;
|
||||
}
|
||||
if (d->ipld_next != NULL)
|
||||
d->ipld_next->ipld_pnext = d->ipld_pnext;
|
||||
d->ipld_pnext = NULL;
|
||||
@ -935,11 +949,29 @@ ipf_dstlist_table_remove(softc, softd, d)
|
||||
|
||||
ipf_dstlist_table_clearnodes(softd, d);
|
||||
|
||||
if (d->ipld_ref > 0) {
|
||||
d->ipld_flags |= IPDST_DELETE;
|
||||
return;
|
||||
}
|
||||
softd->stats.ipls_numdereflists++;
|
||||
d->ipld_flags |= IPDST_DELETE;
|
||||
|
||||
ipf_dstlist_table_deref(softc, softd, d);
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* Function: ipf_dstlist_table_free */
|
||||
/* Returns: Nil */
|
||||
/* Parameters: softd(I) - pointer to the destination list context */
|
||||
/* d(I) - pointer to destination list */
|
||||
/* */
|
||||
/* Free up a destination list data structure and any other memory that was */
|
||||
/* directly allocated as part of creating it. Individual destination list */
|
||||
/* nodes are not freed. It is assumed the caller will have already emptied */
|
||||
/* the destination list. */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
static void
|
||||
ipf_dstlist_table_free(softd, d)
|
||||
ipf_dstl_softc_t *softd;
|
||||
ippool_dst_t *d;
|
||||
{
|
||||
MUTEX_DESTROY(&d->ipld_lock);
|
||||
|
||||
if ((d->ipld_flags & IPDST_DELETE) != 0)
|
||||
@ -977,7 +1009,7 @@ ipf_dstlist_table_deref(softc, arg, table)
|
||||
if (d->ipld_ref > 0)
|
||||
return d->ipld_ref;
|
||||
|
||||
ipf_dstlist_table_remove(softc, arg, table);
|
||||
ipf_dstlist_table_free(arg, d);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -986,7 +1018,8 @@ ipf_dstlist_table_deref(softc, arg, table)
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* Function: ipf_dstlist_table_clearnodes */
|
||||
/* Returns: Nil */
|
||||
/* Parameters: dst(I) - pointer to soft context main structure */
|
||||
/* Parameters: softd(I) - pointer to the destination list context */
|
||||
/* dst(I) - pointer to destination list */
|
||||
/* */
|
||||
/* Free all of the destination nodes attached to the given table. */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
@ -997,6 +1030,9 @@ ipf_dstlist_table_clearnodes(softd, dst)
|
||||
{
|
||||
ipf_dstnode_t *node;
|
||||
|
||||
if (dst->ipld_dests == NULL)
|
||||
return;
|
||||
|
||||
while ((node = *dst->ipld_dests) != NULL) {
|
||||
ipf_dstlist_node_free(softd, dst, node);
|
||||
}
|
||||
@ -1065,7 +1101,8 @@ ipf_dstlist_select_ref(arg, unit, name)
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* Function: ipf_dstlist_select */
|
||||
/* Returns: void * - NULL = failure, else pointer to table */
|
||||
/* Parameters: d(I) - pointer to destination list */
|
||||
/* Parameters: fin(I) - pointer to packet information */
|
||||
/* d(I) - pointer to destination list */
|
||||
/* */
|
||||
/* Find the next node in the destination list to be used according to the */
|
||||
/* defined policy. Of these, "connection" is the most expensive policy to */
|
||||
@ -1203,10 +1240,12 @@ ipf_dstlist_select(fin, d)
|
||||
/* Parameters: fin(I) - pointer to packet information */
|
||||
/* group(I) - destination pool to search */
|
||||
/* addr(I) - pointer to store selected address */
|
||||
/* pfdp(O) - pointer to storage for selected destination node */
|
||||
/* */
|
||||
/* This function is only responsible for obtaining the next IP address for */
|
||||
/* use and storing it in the caller's address space (addr). No permanent */
|
||||
/* reference is currently kept on the node. */
|
||||
/* use and storing it in the caller's address space (addr). "addr" is only */
|
||||
/* used for storage if pfdp is NULL. No permanent reference is currently */
|
||||
/* kept on the node. */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
int
|
||||
ipf_dstlist_select_node(fin, group, addr, pfdp)
|
||||
|
7
external/bsd/ipf/dist/ip_dstlist.h
vendored
7
external/bsd/ipf/dist/ip_dstlist.h
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: ip_dstlist.h,v 1.1.1.1 2012/03/23 21:19:53 christos Exp $ */
|
||||
/* $NetBSD: ip_dstlist.h,v 1.1.1.2 2012/07/22 13:44:12 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id: ip_dstlist.h,v 1.5.2.4 2012/01/26 05:44:25 darren_r Exp
|
||||
* $Id: ip_dstlist.h,v 1.1.1.2 2012/07/22 13:44:12 darrenr Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IP_DSTLIST_H__
|
||||
@ -14,7 +14,6 @@
|
||||
typedef struct ipf_dstnode {
|
||||
struct ipf_dstnode *ipfd_next;
|
||||
struct ipf_dstnode **ipfd_pnext;
|
||||
ipfmutex_t *ipfd_plock;
|
||||
ipfmutex_t ipfd_lock;
|
||||
frdest_t ipfd_dest;
|
||||
u_long ipfd_syncat;
|
||||
|
10
external/bsd/ipf/dist/ip_fil_compat.c
vendored
10
external/bsd/ipf/dist/ip_fil_compat.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: ip_fil_compat.c,v 1.1.1.1 2012/03/23 21:20:00 christos Exp $ */
|
||||
/* $NetBSD: ip_fil_compat.c,v 1.1.1.2 2012/07/22 13:44:16 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2003 by Darren Reed.
|
||||
* Copyright (C) 2002-2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*/
|
||||
@ -3765,7 +3765,7 @@ frentry_current_to_4_1_34(current, old)
|
||||
|
||||
old->fr_lock = fr->fr_lock;
|
||||
old->fr_next = fr->fr_next;
|
||||
old->fr_grp = fr->fr_grp;
|
||||
old->fr_grp = (void *)fr->fr_grp;
|
||||
old->fr_isc = fr->fr_isc;
|
||||
old->fr_ifas[0] = fr->fr_ifas[0];
|
||||
old->fr_ifas[1] = fr->fr_ifas[1];
|
||||
@ -3860,7 +3860,7 @@ frentry_current_to_4_1_16(current, old)
|
||||
|
||||
old->fr_lock = fr->fr_lock;
|
||||
old->fr_next = fr->fr_next;
|
||||
old->fr_grp = fr->fr_grp;
|
||||
old->fr_grp = (void *)fr->fr_grp;
|
||||
old->fr_isc = fr->fr_isc;
|
||||
old->fr_ifas[0] = fr->fr_ifas[0];
|
||||
old->fr_ifas[1] = fr->fr_ifas[1];
|
||||
@ -3955,7 +3955,7 @@ frentry_current_to_4_1_0(current, old)
|
||||
|
||||
old->fr_lock = fr->fr_lock;
|
||||
old->fr_next = fr->fr_next;
|
||||
old->fr_grp = fr->fr_grp;
|
||||
old->fr_grp = (void *)fr->fr_grp;
|
||||
old->fr_isc = fr->fr_isc;
|
||||
old->fr_ifas[0] = fr->fr_ifas[0];
|
||||
old->fr_ifas[1] = fr->fr_ifas[1];
|
||||
|
181
external/bsd/ipf/dist/ip_htable.c
vendored
181
external/bsd/ipf/dist/ip_htable.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ip_htable.c,v 1.1.1.1 2012/03/23 21:19:55 christos Exp $ */
|
||||
/* $NetBSD: ip_htable.c,v 1.1.1.2 2012/07/22 13:44:17 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
@ -53,7 +53,7 @@ struct file;
|
||||
/* END OF INCLUDES */
|
||||
|
||||
#if !defined(lint)
|
||||
static const char rcsid[] = "@(#)Id";
|
||||
static const char rcsid[] = "@(#)$Id: ip_htable.c,v 1.1.1.2 2012/07/22 13:44:17 darrenr Exp $";
|
||||
#endif
|
||||
|
||||
# ifdef USE_INET6
|
||||
@ -144,8 +144,10 @@ ipf_htable_soft_create(softc)
|
||||
ipf_htable_softc_t *softh;
|
||||
|
||||
KMALLOC(softh, ipf_htable_softc_t *);
|
||||
if (softh == NULL)
|
||||
if (softh == NULL) {
|
||||
IPFERROR(30026);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bzero((char *)softh, sizeof(*softh));
|
||||
|
||||
@ -277,11 +279,31 @@ ipf_htable_create(softc, arg, op)
|
||||
iplookupop_t *op;
|
||||
{
|
||||
ipf_htable_softc_t *softh = arg;
|
||||
iphtable_t *iph, *oiph;
|
||||
iphtable_t htab, *iph, *oiph;
|
||||
char name[FR_GROUPLEN];
|
||||
int err, i, unit;
|
||||
|
||||
if (op->iplo_size != sizeof(htab)) {
|
||||
IPFERROR(30024);
|
||||
return EINVAL;
|
||||
}
|
||||
err = COPYIN(op->iplo_struct, &htab, sizeof(htab));
|
||||
if (err != 0) {
|
||||
IPFERROR(30003);
|
||||
return EFAULT;
|
||||
}
|
||||
|
||||
unit = op->iplo_unit;
|
||||
if (htab.iph_unit != unit) {
|
||||
IPFERROR(30005);
|
||||
return EINVAL;
|
||||
}
|
||||
if (htab.iph_size < 1) {
|
||||
IPFERROR(30025);
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
|
||||
if ((op->iplo_arg & IPHASH_ANON) == 0) {
|
||||
iph = ipf_htable_exists(softh, unit, op->iplo_name);
|
||||
if (iph != NULL) {
|
||||
@ -301,17 +323,7 @@ ipf_htable_create(softc, arg, op)
|
||||
IPFERROR(30002);
|
||||
return ENOMEM;
|
||||
}
|
||||
err = COPYIN(op->iplo_struct, iph, sizeof(*iph));
|
||||
if (err != 0) {
|
||||
KFREE(iph);
|
||||
IPFERROR(30003);
|
||||
return EFAULT;
|
||||
}
|
||||
|
||||
if (iph->iph_unit != unit) {
|
||||
IPFERROR(30005);
|
||||
return EINVAL;
|
||||
}
|
||||
*iph = htab;
|
||||
|
||||
if ((op->iplo_arg & IPHASH_ANON) != 0) {
|
||||
i = IPHASH_ANON;
|
||||
@ -332,6 +344,10 @@ ipf_htable_create(softc, arg, op)
|
||||
(void)strncpy(iph->iph_name, name, sizeof(iph->iph_name));
|
||||
(void)strncpy(op->iplo_name, name, sizeof(op->iplo_name));
|
||||
iph->iph_type |= IPHASH_ANON;
|
||||
} else {
|
||||
(void)strncpy(iph->iph_name, op->iplo_name,
|
||||
sizeof(iph->iph_name));
|
||||
iph->iph_name[sizeof(iph->iph_name) - 1] = '\0';
|
||||
}
|
||||
|
||||
KMALLOCS(iph->iph_table, iphtent_t **,
|
||||
@ -348,9 +364,10 @@ ipf_htable_create(softc, arg, op)
|
||||
iph->iph_maskset[1] = 0;
|
||||
iph->iph_maskset[2] = 0;
|
||||
iph->iph_maskset[3] = 0;
|
||||
iph->iph_list = NULL;
|
||||
|
||||
iph->iph_ref = 1;
|
||||
iph->iph_list = NULL;
|
||||
iph->iph_tail = &iph->iph_list;
|
||||
iph->iph_next = softh->ipf_htables[unit + 1];
|
||||
iph->iph_pnext = &softh->ipf_htables[unit + 1];
|
||||
if (softh->ipf_htables[unit + 1] != NULL)
|
||||
@ -608,6 +625,9 @@ ipf_htent_remove(softc, arg, iph, ipe)
|
||||
iphtent_t *ipe;
|
||||
{
|
||||
|
||||
if (iph->iph_tail == &ipe->ipe_next)
|
||||
iph->iph_tail = ipe->ipe_pnext;
|
||||
|
||||
if (ipe->ipe_hnext != NULL)
|
||||
ipe->ipe_hnext->ipe_phnext = ipe->ipe_phnext;
|
||||
if (ipe->ipe_phnext != NULL)
|
||||
@ -633,8 +653,7 @@ ipf_htent_remove(softc, arg, iph, ipe)
|
||||
{
|
||||
case IPHASH_GROUPMAP :
|
||||
if (ipe->ipe_group != NULL)
|
||||
ipf_group_del(softc, ipe->ipe_group, IPL_LOGIPF,
|
||||
softc->ipf_active);
|
||||
ipf_group_del(softc, ipe->ipe_ptr, NULL);
|
||||
break;
|
||||
|
||||
default :
|
||||
@ -902,13 +921,8 @@ ipf_htent_insert(softc, arg, iph, ipeo)
|
||||
|
||||
bcopy((char *)ipeo, (char *)ipe, sizeof(*ipe));
|
||||
ipe->ipe_addr.i6[0] &= ipe->ipe_mask.i6[0];
|
||||
ipe->ipe_addr.i6[1] &= ipe->ipe_mask.i6[1];
|
||||
ipe->ipe_addr.i6[2] &= ipe->ipe_mask.i6[2];
|
||||
ipe->ipe_addr.i6[3] &= ipe->ipe_mask.i6[3];
|
||||
if (ipe->ipe_family == AF_INET) {
|
||||
bits = count4bits(ipe->ipe_mask.in4_addr);
|
||||
ipe->ipe_addr.i6[0] = ntohl(ipe->ipe_addr.i6[0]);
|
||||
ipe->ipe_mask.i6[0] = ntohl(ipe->ipe_mask.i6[0]);
|
||||
ipe->ipe_addr.i6[1] = 0;
|
||||
ipe->ipe_addr.i6[2] = 0;
|
||||
ipe->ipe_addr.i6[3] = 0;
|
||||
@ -920,15 +934,11 @@ ipf_htent_insert(softc, arg, iph, ipeo)
|
||||
} else
|
||||
#ifdef USE_INET6
|
||||
if (ipe->ipe_family == AF_INET6) {
|
||||
ipe->ipe_addr.i6[1] &= ipe->ipe_mask.i6[1];
|
||||
ipe->ipe_addr.i6[2] &= ipe->ipe_mask.i6[2];
|
||||
ipe->ipe_addr.i6[3] &= ipe->ipe_mask.i6[3];
|
||||
|
||||
bits = count6bits(ipe->ipe_mask.i6);
|
||||
ipe->ipe_addr.i6[0] = ntohl(ipe->ipe_addr.i6[0]);
|
||||
ipe->ipe_addr.i6[1] = ntohl(ipe->ipe_addr.i6[1]);
|
||||
ipe->ipe_addr.i6[2] = ntohl(ipe->ipe_addr.i6[2]);
|
||||
ipe->ipe_addr.i6[3] = ntohl(ipe->ipe_addr.i6[3]);
|
||||
ipe->ipe_mask.i6[0] = ntohl(ipe->ipe_mask.i6[0]);
|
||||
ipe->ipe_mask.i6[1] = ntohl(ipe->ipe_mask.i6[1]);
|
||||
ipe->ipe_mask.i6[2] = ntohl(ipe->ipe_mask.i6[2]);
|
||||
ipe->ipe_mask.i6[3] = ntohl(ipe->ipe_mask.i6[3]);
|
||||
hv = IPE_V6_HASH_FN(ipe->ipe_addr.i6,
|
||||
ipe->ipe_mask.i6, iph->iph_size);
|
||||
} else
|
||||
@ -947,11 +957,10 @@ ipf_htent_insert(softc, arg, iph, ipeo)
|
||||
iph->iph_table[hv]->ipe_phnext = &ipe->ipe_hnext;
|
||||
iph->iph_table[hv] = ipe;
|
||||
|
||||
ipe->ipe_next = iph->iph_list;
|
||||
ipe->ipe_pnext = &iph->iph_list;
|
||||
if (ipe->ipe_next != NULL)
|
||||
ipe->ipe_next->ipe_pnext = &ipe->ipe_next;
|
||||
iph->iph_list = ipe;
|
||||
ipe->ipe_pnext = iph->iph_tail;
|
||||
*iph->iph_tail = ipe;
|
||||
iph->iph_tail = &ipe->ipe_next;
|
||||
ipe->ipe_next = NULL;
|
||||
|
||||
if (ipe->ipe_die != 0) {
|
||||
/*
|
||||
@ -991,21 +1000,11 @@ ipf_htent_insert(softc, arg, iph, ipeo)
|
||||
}
|
||||
|
||||
if (ipe->ipe_family == AF_INET) {
|
||||
if ((bits >= 0) && (bits != 32))
|
||||
iph->iph_maskset[0] |= 1 << bits;
|
||||
ipf_inet_mask_add(bits, &iph->iph_v4_masks);
|
||||
}
|
||||
#ifdef USE_INET6
|
||||
else if (ipe->ipe_family == AF_INET6) {
|
||||
if ((bits >= 0) && (bits != 128)) {
|
||||
if (bits >= 96)
|
||||
iph->iph_maskset[3] |= 1 << (bits - 96);
|
||||
else if (bits >= 64)
|
||||
iph->iph_maskset[2] |= 1 << (bits - 64);
|
||||
else if (bits >= 32)
|
||||
iph->iph_maskset[1] |= 1 << (bits - 32);
|
||||
else
|
||||
iph->iph_maskset[0] |= 1 << bits;
|
||||
}
|
||||
ipf_inet6_mask_add(bits, &ipe->ipe_mask, &iph->iph_v6_masks);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1056,8 +1055,6 @@ ipf_htent_find(iph, ipeo)
|
||||
ipe.ipe_addr.i6[3] &= ipe.ipe_mask.i6[3];
|
||||
if (ipe.ipe_family == AF_INET) {
|
||||
bits = count4bits(ipe.ipe_mask.in4_addr);
|
||||
ipe.ipe_addr.i6[0] = ntohl(ipe.ipe_addr.i6[0]);
|
||||
ipe.ipe_mask.i6[0] = ntohl(ipe.ipe_mask.i6[0]);
|
||||
ipe.ipe_addr.i6[1] = 0;
|
||||
ipe.ipe_addr.i6[2] = 0;
|
||||
ipe.ipe_addr.i6[3] = 0;
|
||||
@ -1070,14 +1067,6 @@ ipf_htent_find(iph, ipeo)
|
||||
#ifdef USE_INET6
|
||||
if (ipe.ipe_family == AF_INET6) {
|
||||
bits = count6bits(ipe.ipe_mask.i6);
|
||||
ipe.ipe_addr.i6[0] = ntohl(ipe.ipe_addr.i6[0]);
|
||||
ipe.ipe_addr.i6[1] = ntohl(ipe.ipe_addr.i6[1]);
|
||||
ipe.ipe_addr.i6[2] = ntohl(ipe.ipe_addr.i6[2]);
|
||||
ipe.ipe_addr.i6[3] = ntohl(ipe.ipe_addr.i6[3]);
|
||||
ipe.ipe_mask.i6[0] = ntohl(ipe.ipe_mask.i6[0]);
|
||||
ipe.ipe_mask.i6[1] = ntohl(ipe.ipe_mask.i6[1]);
|
||||
ipe.ipe_mask.i6[2] = ntohl(ipe.ipe_mask.i6[2]);
|
||||
ipe.ipe_mask.i6[3] = ntohl(ipe.ipe_mask.i6[3]);
|
||||
hv = IPE_V6_HASH_FN(ipe.ipe_addr.i6,
|
||||
ipe.ipe_mask.i6, iph->iph_size);
|
||||
} else
|
||||
@ -1198,14 +1187,15 @@ ipf_iphmfind(iph, addr)
|
||||
iphtable_t *iph;
|
||||
struct in_addr *addr;
|
||||
{
|
||||
u_32_t hmsk, msk, ips;
|
||||
u_32_t msk, ips;
|
||||
iphtent_t *ipe;
|
||||
u_int hv;
|
||||
int i;
|
||||
|
||||
hmsk = iph->iph_maskset[0];
|
||||
msk = 0xffffffff;
|
||||
i = 0;
|
||||
maskloop:
|
||||
ips = ntohl(addr->s_addr) & msk;
|
||||
msk = iph->iph_v4_masks.imt4_active[i];
|
||||
ips = addr->s_addr & msk;
|
||||
hv = IPE_V4_HASH_FN(ips, msk, iph->iph_size);
|
||||
for (ipe = iph->iph_table[hv]; (ipe != NULL); ipe = ipe->ipe_hnext) {
|
||||
if ((ipe->ipe_family != AF_INET) ||
|
||||
@ -1216,17 +1206,10 @@ maskloop:
|
||||
break;
|
||||
}
|
||||
|
||||
if ((ipe == NULL) && (hmsk != 0)) {
|
||||
while (hmsk != 0) {
|
||||
msk <<= 1;
|
||||
if (hmsk & 0x80000000)
|
||||
break;
|
||||
hmsk <<= 1;
|
||||
}
|
||||
if (hmsk != 0) {
|
||||
hmsk <<= 1;
|
||||
if (ipe == NULL) {
|
||||
i++;
|
||||
if (i < iph->iph_v4_masks.imt4_max)
|
||||
goto maskloop;
|
||||
}
|
||||
}
|
||||
return ipe;
|
||||
}
|
||||
@ -1286,7 +1269,7 @@ ipf_htable_iter_next(softc, arg, token, ilp)
|
||||
case IPFLOOKUPITER_NODE :
|
||||
node = token->ipt_data;
|
||||
if (node == NULL) {
|
||||
iph = ipf_htable_find(arg, ilp->ili_unit + 1,
|
||||
iph = ipf_htable_find(arg, ilp->ili_unit,
|
||||
ilp->ili_name);
|
||||
if (iph == NULL) {
|
||||
IPFERROR(30009);
|
||||
@ -1349,7 +1332,7 @@ ipf_htable_iter_next(softc, arg, token, ilp)
|
||||
break;
|
||||
}
|
||||
|
||||
if (hnext != NULL)
|
||||
if (hnext == NULL)
|
||||
ipf_token_mark_complete(token);
|
||||
|
||||
return err;
|
||||
@ -1411,56 +1394,32 @@ ipf_iphmfind6(iph, addr)
|
||||
iphtable_t *iph;
|
||||
i6addr_t *addr;
|
||||
{
|
||||
i6addr_t msk, ips;
|
||||
i6addr_t *msk, ips;
|
||||
iphtent_t *ipe;
|
||||
u_32_t hmsk;
|
||||
u_int hv;
|
||||
int i;
|
||||
|
||||
for (i = 3, hmsk = iph->iph_maskset[3]; (hmsk == 0) && (i >= 0); i--)
|
||||
hmsk = iph->iph_maskset[i];
|
||||
|
||||
msk.i6[0] = 0xffffffff;
|
||||
msk.i6[1] = 0xffffffff;
|
||||
msk.i6[2] = 0xffffffff;
|
||||
msk.i6[3] = 0xffffffff;
|
||||
ips.i6[0] = ntohl(addr->i6[0]);
|
||||
ips.i6[1] = ntohl(addr->i6[1]);
|
||||
ips.i6[2] = ntohl(addr->i6[2]);
|
||||
ips.i6[3] = ntohl(addr->i6[3]);
|
||||
i = 0;
|
||||
maskloop:
|
||||
if (i >= 0)
|
||||
ips.i6[i] = ntohl(addr->i6[i]) & msk.i6[i];
|
||||
hv = IPE_V6_HASH_FN(ips.i6, msk.i6, iph->iph_size);
|
||||
msk = iph->iph_v6_masks.imt6_active + i;
|
||||
ips.i6[0] = addr->i6[0] & msk->i6[0];
|
||||
ips.i6[1] = addr->i6[1] & msk->i6[1];
|
||||
ips.i6[2] = addr->i6[2] & msk->i6[2];
|
||||
ips.i6[3] = addr->i6[3] & msk->i6[3];
|
||||
hv = IPE_V6_HASH_FN(ips.i6, msk->i6, iph->iph_size);
|
||||
for (ipe = iph->iph_table[hv]; (ipe != NULL); ipe = ipe->ipe_next) {
|
||||
if ((ipe->ipe_family != AF_INET6) ||
|
||||
IP6_NEQ(&ipe->ipe_mask, &msk) ||
|
||||
IP6_NEQ(&ipe->ipe_mask, msk) ||
|
||||
IP6_NEQ(&ipe->ipe_addr, &ips)) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ((ipe == NULL) && (i >= 0)) {
|
||||
nextmask:
|
||||
if (hmsk != 0) {
|
||||
while (hmsk != 0) {
|
||||
msk.i6[i] <<= 1;
|
||||
if (hmsk & 0x80000000)
|
||||
break;
|
||||
hmsk <<= 1;
|
||||
}
|
||||
if (hmsk != 0) {
|
||||
hmsk <<= 1;
|
||||
goto maskloop;
|
||||
}
|
||||
} else if (i >= 0) {
|
||||
ips.i6[i] = 0;
|
||||
msk.i6[i] = 0;
|
||||
i--;
|
||||
hmsk = iph->iph_maskset[i];
|
||||
goto nextmask;
|
||||
}
|
||||
if (ipe == NULL) {
|
||||
i++;
|
||||
if (i < iph->iph_v6_masks.imt6_max)
|
||||
goto maskloop;
|
||||
}
|
||||
return ipe;
|
||||
}
|
||||
|
7
external/bsd/ipf/dist/ip_htable.h
vendored
7
external/bsd/ipf/dist/ip_htable.h
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ip_htable.h,v 1.1.1.1 2012/03/23 21:20:01 christos Exp $ */
|
||||
/* $NetBSD: ip_htable.h,v 1.1.1.2 2012/07/22 13:44:17 darrenr Exp $ */
|
||||
|
||||
#ifndef __IP_HTABLE_H__
|
||||
#define __IP_HTABLE_H__
|
||||
@ -42,6 +42,11 @@ typedef struct iphtable_s {
|
||||
struct iphtable_s *iph_next, **iph_pnext;
|
||||
struct iphtent_s **iph_table;
|
||||
struct iphtent_s *iph_list;
|
||||
struct iphtent_s **iph_tail;
|
||||
#ifdef USE_INET6
|
||||
ipf_v6_masktab_t iph_v6_masks;
|
||||
#endif
|
||||
ipf_v4_masktab_t iph_v4_masks;
|
||||
size_t iph_size; /* size of hash table */
|
||||
u_long iph_seed; /* hashing seed */
|
||||
u_32_t iph_flags;
|
||||
|
13
external/bsd/ipf/dist/ip_irc_pxy.c
vendored
13
external/bsd/ipf/dist/ip_irc_pxy.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: ip_irc_pxy.c,v 1.1.1.1 2012/03/23 21:19:56 christos Exp $ */
|
||||
/* $NetBSD: ip_irc_pxy.c,v 1.1.1.2 2012/07/22 13:44:17 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2008 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: ip_irc_pxy.c,v 1.1.1.2 2012/07/22 13:44:17 darrenr Exp $
|
||||
*/
|
||||
|
||||
#define IPF_IRC_PROXY
|
||||
@ -234,11 +234,13 @@ ipf_p_irc_new(arg, fin, aps, nat)
|
||||
{
|
||||
ircinfo_t *irc;
|
||||
|
||||
if (fin->fin_v != 4)
|
||||
return -1;
|
||||
|
||||
KMALLOC(irc, ircinfo_t *);
|
||||
if (irc == NULL)
|
||||
return -1;
|
||||
|
||||
fin = fin; /* LINT */
|
||||
nat = nat; /* LINT */
|
||||
|
||||
aps->aps_data = irc;
|
||||
@ -358,6 +360,7 @@ ipf_p_irc_send(fin, nat)
|
||||
/* the mbuf chain will be extended if necessary by m_copyback() */
|
||||
#endif
|
||||
COPYBACK(m, off, nlen, newbuf);
|
||||
fin->fin_flx |= FI_DOCKSUM;
|
||||
|
||||
if (inc != 0) {
|
||||
#if defined(MENTAT) || defined(__sgi)
|
||||
@ -372,7 +375,7 @@ ipf_p_irc_send(fin, nat)
|
||||
sum2 -= sum1;
|
||||
sum2 = (sum2 & 0xffff) + (sum2 >> 16);
|
||||
|
||||
ipf_fix_outcksum(fin, &ip->ip_sum, sum2);
|
||||
ipf_fix_outcksum(0, &ip->ip_sum, sum2, 0);
|
||||
#endif
|
||||
fin->fin_plen += inc;
|
||||
ip->ip_len = htons(fin->fin_plen);
|
||||
|
10
external/bsd/ipf/dist/ip_lookup.c
vendored
10
external/bsd/ipf/dist/ip_lookup.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: ip_lookup.c,v 1.1.1.1 2012/03/23 21:19:56 christos Exp $ */
|
||||
/* $NetBSD: ip_lookup.c,v 1.1.1.2 2012/07/22 13:44:18 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*/
|
||||
@ -61,7 +61,7 @@ struct file;
|
||||
/* END OF INCLUDES */
|
||||
|
||||
#if !defined(lint)
|
||||
static const char rcsid[] = "@(#)Id";
|
||||
static const char rcsid[] = "@(#)$Id: ip_lookup.c,v 1.1.1.2 2012/07/22 13:44:18 darrenr Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -783,7 +783,7 @@ ipf_lookup_iterderef(softc, type, data)
|
||||
WRITE_ENTER(&softc->ipf_poolrw);
|
||||
|
||||
for (i = 0; i < MAX_BACKENDS; i++) {
|
||||
if (type == backends[i]->ipfl_type) {
|
||||
if (lkey->ilik_type == backends[i]->ipfl_type) {
|
||||
(*backends[i]->ipfl_iter_deref)(softc,
|
||||
softl->ipf_back[i],
|
||||
lkey->ilik_otype,
|
||||
@ -874,7 +874,7 @@ ipf_lookup_res_num(softc, unit, type, number, funcptr)
|
||||
/* */
|
||||
/* Search for the "table" number passed in amongst those configured for */
|
||||
/* that particular type. If the type is recognised then the function to */
|
||||
/* call to do the IP address search will be change, regardless of whether */
|
||||
/* call to do the IP address search will be changed, regardless of whether */
|
||||
/* or not the "table" number exists. */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
void *
|
||||
|
6
external/bsd/ipf/dist/ip_lookup.h
vendored
6
external/bsd/ipf/dist/ip_lookup.h
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: ip_lookup.h,v 1.1.1.1 2012/03/23 21:19:56 christos Exp $ */
|
||||
/* $NetBSD: ip_lookup.h,v 1.1.1.2 2012/07/22 13:44:19 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: ip_lookup.h,v 1.1.1.2 2012/07/22 13:44:19 darrenr Exp $
|
||||
*/
|
||||
#ifndef __IP_LOOKUP_H__
|
||||
#define __IP_LOOKUP_H__
|
||||
|
1111
external/bsd/ipf/dist/ip_nat6.c
vendored
1111
external/bsd/ipf/dist/ip_nat6.c
vendored
File diff suppressed because it is too large
Load Diff
172
external/bsd/ipf/dist/ip_pool.c
vendored
172
external/bsd/ipf/dist/ip_pool.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ip_pool.c,v 1.1.1.1 2012/03/23 21:19:54 christos Exp $ */
|
||||
/* $NetBSD: ip_pool.c,v 1.1.1.2 2012/07/22 13:44:22 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
@ -66,7 +66,7 @@ struct file;
|
||||
|
||||
#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_pool.c,v 1.1.1.2 2012/07/22 13:44:22 darrenr Exp $";
|
||||
#endif
|
||||
|
||||
typedef struct ipf_pool_softc_s {
|
||||
@ -77,7 +77,8 @@ typedef struct ipf_pool_softc_s {
|
||||
} ipf_pool_softc_t;
|
||||
|
||||
|
||||
static void ipf_pool_clearnodes __P((ipf_pool_softc_t *, ip_pool_t *));
|
||||
static void ipf_pool_clearnodes __P((ipf_main_softc_t *, ipf_pool_softc_t *,
|
||||
ip_pool_t *));
|
||||
static int ipf_pool_create __P((ipf_main_softc_t *, ipf_pool_softc_t *, iplookupop_t *));
|
||||
static int ipf_pool_deref __P((ipf_main_softc_t *, void *, void *));
|
||||
static int ipf_pool_destroy __P((ipf_main_softc_t *, ipf_pool_softc_t *, int, char *));
|
||||
@ -85,7 +86,8 @@ static void *ipf_pool_exists __P((ipf_pool_softc_t *, int, char *));
|
||||
static void *ipf_pool_find __P((void *, int, char *));
|
||||
static ip_pool_node_t *ipf_pool_findeq __P((ipf_pool_softc_t *, ip_pool_t *,
|
||||
addrfamily_t *, addrfamily_t *));
|
||||
static void ipf_pool_free __P((ipf_pool_softc_t *, ip_pool_t *));
|
||||
static void ipf_pool_free __P((ipf_main_softc_t *, ipf_pool_softc_t *,
|
||||
ip_pool_t *));
|
||||
static int ipf_pool_insert_node __P((ipf_main_softc_t *, ipf_pool_softc_t *,
|
||||
ip_pool_t *, struct ip_pool_node *));
|
||||
static int ipf_pool_iter_deref __P((ipf_main_softc_t *, void *, int, int, void *));
|
||||
@ -97,8 +99,8 @@ static int ipf_pool_node_add __P((ipf_main_softc_t *, void *, iplookupop_t *,
|
||||
static int ipf_pool_node_del __P((ipf_main_softc_t *, void *, iplookupop_t *,
|
||||
int));
|
||||
static void ipf_pool_node_deref __P((ipf_pool_softc_t *, ip_pool_node_t *));
|
||||
static int ipf_pool_remove_node __P((ipf_pool_softc_t *, ip_pool_t *,
|
||||
ip_pool_node_t *));
|
||||
static int ipf_pool_remove_node __P((ipf_main_softc_t *, ipf_pool_softc_t *,
|
||||
ip_pool_t *, ip_pool_node_t *));
|
||||
static int ipf_pool_search __P((ipf_main_softc_t *, void *, int,
|
||||
void *, u_int));
|
||||
static void *ipf_pool_soft_create __P((ipf_main_softc_t *));
|
||||
@ -161,7 +163,6 @@ main(argc, argv)
|
||||
ipo = ipf_pool_exists(0, "0");
|
||||
|
||||
node.ipn_addr.adf_family = AF_INET;
|
||||
node.ipn_mask.adf_family = AF_INET;
|
||||
|
||||
node.ipn_addr.adf_addr.in4.s_addr = 0x0a010203;
|
||||
node.ipn_mask.adf_addr.in4.s_addr = 0xffffffff;
|
||||
@ -270,13 +271,16 @@ ipf_pool_soft_create(softc)
|
||||
ipf_pool_softc_t *softp;
|
||||
|
||||
KMALLOC(softp, ipf_pool_softc_t *);
|
||||
if (softc == NULL)
|
||||
if (softp == NULL) {
|
||||
IPFERROR(70032);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bzero((char *)softp, sizeof(*softp));
|
||||
|
||||
softp->ipf_radix = ipf_rx_create();
|
||||
if (softp->ipf_radix == NULL) {
|
||||
IPFERROR(70033);
|
||||
KFREE(softp);
|
||||
return NULL;
|
||||
}
|
||||
@ -334,7 +338,6 @@ ipf_pool_soft_fini(softc, arg)
|
||||
(void) ipf_pool_destroy(softc, arg, i, p->ipo_name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -367,6 +370,9 @@ ipf_pool_soft_destroy(softc, arg)
|
||||
/* arg(I) - pointer to local context to use */
|
||||
/* op(I) - pointer to lookup operatin data */
|
||||
/* */
|
||||
/* When adding a new node, a check is made to ensure that the address/mask */
|
||||
/* pair supplied has been appropriately prepared by applying the mask to */
|
||||
/* the address prior to calling for the pair to be added. */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
static int
|
||||
ipf_pool_node_add(softc, arg, op, uid)
|
||||
@ -390,17 +396,55 @@ ipf_pool_node_add(softc, arg, op, uid)
|
||||
return EFAULT;
|
||||
}
|
||||
|
||||
if (node.ipn_addr.adf_family != node.ipn_mask.adf_family) {
|
||||
IPFERROR(70016);
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
p = ipf_pool_find(arg, op->iplo_unit, op->iplo_name);
|
||||
if (p == NULL) {
|
||||
IPFERROR(70017);
|
||||
return ESRCH;
|
||||
}
|
||||
|
||||
if (node.ipn_addr.adf_family == AF_INET) {
|
||||
if (node.ipn_addr.adf_len != offsetof(addrfamily_t, adf_addr) +
|
||||
sizeof(struct in_addr)) {
|
||||
IPFERROR(70028);
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
#ifdef USE_INET6
|
||||
else if (node.ipn_addr.adf_family == AF_INET6) {
|
||||
if (node.ipn_addr.adf_len != offsetof(addrfamily_t, adf_addr) +
|
||||
sizeof(struct in6_addr)) {
|
||||
IPFERROR(70034);
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (node.ipn_mask.adf_len != node.ipn_addr.adf_len) {
|
||||
IPFERROR(70029);
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check that the address/mask pair works.
|
||||
*/
|
||||
if (node.ipn_addr.adf_family == AF_INET) {
|
||||
if ((node.ipn_addr.adf_addr.in4.s_addr &
|
||||
node.ipn_mask.adf_addr.in4.s_addr) !=
|
||||
node.ipn_addr.adf_addr.in4.s_addr) {
|
||||
IPFERROR(70035);
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
#ifdef USE_INET6
|
||||
else if (node.ipn_addr.adf_family == AF_INET6) {
|
||||
if (IP6_MASKNEQ(&node.ipn_addr.adf_addr.in6,
|
||||
&node.ipn_mask.adf_addr.in6,
|
||||
&node.ipn_addr.adf_addr.in6)) {
|
||||
IPFERROR(70036);
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* add an entry to a pool - return an error if it already
|
||||
* exists remove an entry from a pool - if it exists
|
||||
@ -449,6 +493,27 @@ ipf_pool_node_del(softc, arg, op, uid)
|
||||
return EFAULT;
|
||||
}
|
||||
|
||||
if (node.ipn_addr.adf_family == AF_INET) {
|
||||
if (node.ipn_addr.adf_len != offsetof(addrfamily_t, adf_addr) +
|
||||
sizeof(struct in_addr)) {
|
||||
IPFERROR(70030);
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
#ifdef USE_INET6
|
||||
else if (node.ipn_addr.adf_family == AF_INET6) {
|
||||
if (node.ipn_addr.adf_len != offsetof(addrfamily_t, adf_addr) +
|
||||
sizeof(struct in6_addr)) {
|
||||
IPFERROR(70037);
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (node.ipn_mask.adf_len != node.ipn_addr.adf_len) {
|
||||
IPFERROR(70031);
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
p = ipf_pool_find(arg, op->iplo_unit, op->iplo_name);
|
||||
if (p == NULL) {
|
||||
IPFERROR(70021);
|
||||
@ -466,7 +531,7 @@ ipf_pool_node_del(softc, arg, op, uid)
|
||||
return EACCES;
|
||||
}
|
||||
|
||||
err = ipf_pool_remove_node(arg, p, m);
|
||||
err = ipf_pool_remove_node(softc, arg, p, m);
|
||||
|
||||
return err;
|
||||
}
|
||||
@ -723,16 +788,17 @@ ipf_pool_search(softc, tptr, ipversion, dptr, bytes)
|
||||
m = NULL;
|
||||
addr = (i6addr_t *)dptr;
|
||||
bzero(&v, sizeof(v));
|
||||
v.adf_len = offsetof(addrfamily_t, adf_addr);
|
||||
|
||||
if (ipversion == 4) {
|
||||
v.adf_family = AF_INET;
|
||||
v.adf_len += sizeof(addr->in4);
|
||||
v.adf_len = offsetof(addrfamily_t, adf_addr) +
|
||||
sizeof(struct in_addr);
|
||||
v.adf_addr.in4 = addr->in4;
|
||||
#ifdef USE_INET6
|
||||
} else if (ipversion == 6) {
|
||||
v.adf_family = AF_INET6;
|
||||
v.adf_len += sizeof(addr->in6);
|
||||
v.adf_len = offsetof(addrfamily_t, adf_addr) +
|
||||
sizeof(struct in6_addr);
|
||||
v.adf_addr.in6 = addr->in6;
|
||||
#endif
|
||||
} else
|
||||
@ -853,11 +919,9 @@ ipf_pool_insert_node(softc, softp, ipo, node)
|
||||
}
|
||||
|
||||
x->ipn_ref = 1;
|
||||
x->ipn_next = ipo->ipo_list;
|
||||
x->ipn_pnext = &ipo->ipo_list;
|
||||
if (ipo->ipo_list != NULL)
|
||||
ipo->ipo_list->ipn_pnext = &x->ipn_next;
|
||||
ipo->ipo_list = x;
|
||||
x->ipn_pnext = ipo->ipo_tail;
|
||||
*ipo->ipo_tail = x;
|
||||
ipo->ipo_tail = &x->ipn_next;
|
||||
|
||||
softp->ipf_pool_stats.ipls_nodes++;
|
||||
|
||||
@ -955,6 +1019,7 @@ ipf_pool_create(softc, softp, op)
|
||||
h->ipo_radix = softp->ipf_radix;
|
||||
h->ipo_ref = 1;
|
||||
h->ipo_list = NULL;
|
||||
h->ipo_tail = &h->ipo_list;
|
||||
h->ipo_unit = unit;
|
||||
h->ipo_next = softp->ipf_pool_list[unit + 1];
|
||||
if (softp->ipf_pool_list[unit + 1] != NULL)
|
||||
@ -979,11 +1044,16 @@ ipf_pool_create(softc, softp, op)
|
||||
/* Remove a node from the pool given by ipo. */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
static int
|
||||
ipf_pool_remove_node(softp, ipo, ipe)
|
||||
ipf_pool_remove_node(softc, softp, ipo, ipe)
|
||||
ipf_main_softc_t *softc;
|
||||
ipf_pool_softc_t *softp;
|
||||
ip_pool_t *ipo;
|
||||
ip_pool_node_t *ipe;
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
if (ipo->ipo_tail == &ipe->ipn_next)
|
||||
ipo->ipo_tail = ipe->ipn_pnext;
|
||||
|
||||
if (ipe->ipn_pnext != NULL)
|
||||
*ipe->ipn_pnext = ipe->ipn_next;
|
||||
@ -995,11 +1065,15 @@ ipf_pool_remove_node(softp, ipo, ipe)
|
||||
if (ipe->ipn_dnext != NULL)
|
||||
ipe->ipn_dnext->ipn_pdnext = ipe->ipn_pdnext;
|
||||
|
||||
ipo->ipo_head->deladdr(ipo->ipo_head, &ipe->ipn_addr, &ipe->ipn_mask);
|
||||
ptr = ipo->ipo_head->deladdr(ipo->ipo_head, &ipe->ipn_addr,
|
||||
&ipe->ipn_mask);
|
||||
|
||||
ipf_pool_node_deref(softp, ipe);
|
||||
|
||||
return 0;
|
||||
if (ptr != NULL) {
|
||||
ipf_pool_node_deref(softp, ipe);
|
||||
return 0;
|
||||
}
|
||||
IPFERROR(70027);
|
||||
return ESRCH;
|
||||
}
|
||||
|
||||
|
||||
@ -1036,12 +1110,12 @@ ipf_pool_destroy(softc, softp, unit, name)
|
||||
}
|
||||
|
||||
if (ipo->ipo_ref != 1) {
|
||||
ipf_pool_clearnodes(softp, ipo);
|
||||
ipf_pool_clearnodes(softc, softp, ipo);
|
||||
ipo->ipo_flags |= IPOOL_DELETE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ipf_pool_free(softp, ipo);
|
||||
ipf_pool_free(softc, softp, ipo);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1089,7 +1163,8 @@ ipf_pool_flush(softc, arg, fp)
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* Function: ipf_pool_free */
|
||||
/* Returns: void */
|
||||
/* Parameters: softp(I) - pointer to soft context pool information */
|
||||
/* Parameters: softc(I) - pointer to soft context main structure */
|
||||
/* softp(I) - pointer to soft context pool information */
|
||||
/* ipo(I) - pointer to pool structure */
|
||||
/* Locks: WRITE(ipf_poolrw) or WRITE(ipf_global) */
|
||||
/* */
|
||||
@ -1102,12 +1177,13 @@ ipf_pool_flush(softc, arg, fp)
|
||||
/* assertion that one of the two (ipf_poolrw,ipf_global) is held. */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
static void
|
||||
ipf_pool_free(softp, ipo)
|
||||
ipf_pool_free(softc, softp, ipo)
|
||||
ipf_main_softc_t *softc;
|
||||
ipf_pool_softc_t *softp;
|
||||
ip_pool_t *ipo;
|
||||
{
|
||||
|
||||
ipf_pool_clearnodes(softp, ipo);
|
||||
ipf_pool_clearnodes(softc, softp, ipo);
|
||||
|
||||
if (ipo->ipo_next != NULL)
|
||||
ipo->ipo_next->ipo_pnext = ipo->ipo_pnext;
|
||||
@ -1122,37 +1198,23 @@ ipf_pool_free(softp, ipo)
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* Function: ipf_pool_clearnodes */
|
||||
/* Returns: void */
|
||||
/* Parameters: softp(I) - pointer to soft context pool information */
|
||||
/* Parameters: softc(I) - pointer to soft context main structure */
|
||||
/* softp(I) - pointer to soft context pool information */
|
||||
/* ipo(I) - pointer to pool structure */
|
||||
/* Locks: WRITE(ipf_poolrw) or WRITE(ipf_global) */
|
||||
/* */
|
||||
/* Deletes all nodes stored in a pool structure. */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
static void
|
||||
ipf_pool_clearnodes(softp, ipo)
|
||||
ipf_pool_clearnodes(softc, softp, ipo)
|
||||
ipf_main_softc_t *softc;
|
||||
ipf_pool_softc_t *softp;
|
||||
ip_pool_t *ipo;
|
||||
{
|
||||
ip_pool_node_t *n, **next;
|
||||
|
||||
for (next = &ipo->ipo_list; (n = *next) != NULL; ) {
|
||||
ipo->ipo_head->deladdr(ipo->ipo_head, &n->ipn_addr,
|
||||
&n->ipn_mask);
|
||||
|
||||
*n->ipn_pnext = n->ipn_next;
|
||||
if (n->ipn_next)
|
||||
n->ipn_next->ipn_pnext = n->ipn_pnext;
|
||||
|
||||
if (n->ipn_pdnext != NULL) {
|
||||
*n->ipn_pdnext = n->ipn_dnext;
|
||||
if (n->ipn_dnext)
|
||||
n->ipn_dnext->ipn_pdnext = n->ipn_pdnext;
|
||||
}
|
||||
|
||||
KFREE(n);
|
||||
|
||||
softp->ipf_pool_stats.ipls_nodes--;
|
||||
}
|
||||
for (next = &ipo->ipo_list; (n = *next) != NULL; )
|
||||
ipf_pool_remove_node(softc, softp, ipo, n);
|
||||
|
||||
ipo->ipo_list = NULL;
|
||||
}
|
||||
@ -1179,7 +1241,7 @@ ipf_pool_deref(softc, arg, pool)
|
||||
ipo->ipo_ref--;
|
||||
|
||||
if (ipo->ipo_ref == 0)
|
||||
ipf_pool_free(arg, ipo);
|
||||
ipf_pool_free(softc, arg, ipo);
|
||||
|
||||
else if ((ipo->ipo_ref == 1) && (ipo->ipo_flags & IPOOL_DELETE))
|
||||
ipf_pool_destroy(softc, arg, ipo->ipo_unit, ipo->ipo_name);
|
||||
@ -1403,7 +1465,7 @@ ipf_pool_expire(softc, arg)
|
||||
*/
|
||||
if (n->ipn_die > softc->ipf_ticks)
|
||||
break;
|
||||
ipf_pool_remove_node(softp, n->ipn_owner, n);
|
||||
ipf_pool_remove_node(softc, softp, n->ipn_owner, n);
|
||||
}
|
||||
}
|
||||
|
||||
|
7
external/bsd/ipf/dist/ip_pool.h
vendored
7
external/bsd/ipf/dist/ip_pool.h
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: ip_pool.h,v 1.1.1.1 2012/03/23 21:19:54 christos Exp $ */
|
||||
/* $NetBSD: ip_pool.h,v 1.1.1.2 2012/07/22 13:44:22 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: ip_pool.h,v 1.1.1.2 2012/07/22 13:44:22 darrenr Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IP_POOL_H__
|
||||
@ -39,6 +39,7 @@ typedef struct ip_pool_s {
|
||||
struct ip_pool_s **ipo_pnext;
|
||||
ipf_rdx_head_t *ipo_head;
|
||||
ip_pool_node_t *ipo_list;
|
||||
ip_pool_node_t **ipo_tail;
|
||||
ip_pool_node_t *ipo_nextaddr;
|
||||
void *ipo_radix;
|
||||
u_long ipo_hits;
|
||||
|
73
external/bsd/ipf/dist/ip_pptp_pxy.c
vendored
73
external/bsd/ipf/dist/ip_pptp_pxy.c
vendored
@ -1,20 +1,44 @@
|
||||
/* $NetBSD: ip_pptp_pxy.c,v 1.1.1.1 2012/03/23 21:19:58 christos Exp $ */
|
||||
/* $NetBSD: ip_pptp_pxy.c,v 1.1.1.2 2012/07/22 13:44:23 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* Simple PPTP transparent proxy for in-kernel use. For use with the NAT
|
||||
* code.
|
||||
*
|
||||
* Id
|
||||
* $Id: ip_pptp_pxy.c,v 1.1.1.2 2012/07/22 13:44:23 darrenr Exp $
|
||||
*
|
||||
*/
|
||||
#define IPF_PPTP_PROXY
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* PPTP proxy
|
||||
*/
|
||||
typedef struct pptp_side {
|
||||
u_32_t pptps_nexthdr;
|
||||
u_32_t pptps_next;
|
||||
int pptps_state;
|
||||
int pptps_gothdr;
|
||||
int pptps_len;
|
||||
int pptps_bytes;
|
||||
char *pptps_wptr;
|
||||
char pptps_buffer[512];
|
||||
} pptp_side_t;
|
||||
|
||||
typedef struct pptp_pxy {
|
||||
nat_t *pptp_nat;
|
||||
struct ipstate *pptp_state;
|
||||
u_short pptp_call[2];
|
||||
pptp_side_t pptp_side[2];
|
||||
ipnat_t *pptp_rule;
|
||||
} pptp_pxy_t;
|
||||
|
||||
typedef struct pptp_hdr {
|
||||
u_short pptph_len;
|
||||
u_short pptph_type;
|
||||
u_32_t pptph_cookie;
|
||||
u_short pptph_len;
|
||||
u_short pptph_type;
|
||||
u_32_t pptph_cookie;
|
||||
} pptp_hdr_t;
|
||||
|
||||
#define PPTP_MSGTYPE_CTL 1
|
||||
@ -92,10 +116,17 @@ ipf_p_pptp_new(arg, fin, aps, nat)
|
||||
nat_t *nat;
|
||||
{
|
||||
pptp_pxy_t *pptp;
|
||||
ipnat_t *ipn, *np;
|
||||
ipnat_t *ipn;
|
||||
ipnat_t *np;
|
||||
int size;
|
||||
ip_t *ip;
|
||||
|
||||
if (fin->fin_v != 4)
|
||||
return -1;
|
||||
|
||||
ip = fin->fin_ip;
|
||||
np = nat->nat_ptr;
|
||||
size = np->in_size;
|
||||
|
||||
if (ipf_nat_outlookup(fin, 0, IPPROTO_GRE, nat->nat_osrcip,
|
||||
ip->ip_dst) != NULL) {
|
||||
@ -103,24 +134,31 @@ ipf_p_pptp_new(arg, fin, aps, nat)
|
||||
printf("ipf_p_pptp_new: GRE session already exists\n");
|
||||
return -1;
|
||||
}
|
||||
np = nat->nat_ptr;
|
||||
|
||||
aps->aps_psiz = sizeof(*pptp) + np->in_namelen;
|
||||
KMALLOCS(aps->aps_data, pptp_pxy_t *, aps->aps_psiz);
|
||||
if (aps->aps_data == NULL) {
|
||||
KMALLOC(pptp, pptp_pxy_t *);
|
||||
if (pptp == NULL) {
|
||||
if (ipf_p_pptp_debug > 0)
|
||||
printf("ipf_p_pptp_new: malloc for aps_data failed\n");
|
||||
return -1;
|
||||
}
|
||||
KMALLOCS(ipn, ipnat_t *, size);
|
||||
if (ipn == NULL) {
|
||||
KFREE(pptp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
aps->aps_data = pptp;
|
||||
aps->aps_psiz = sizeof(*pptp);
|
||||
bzero((char *)pptp, sizeof(*pptp));
|
||||
bzero((char *)ipn, size);
|
||||
pptp->pptp_rule = ipn;
|
||||
|
||||
/*
|
||||
* Create NAT rule against which the tunnel/transport mapping is
|
||||
* created. This is required because the current NAT rule does not
|
||||
* describe GRE but TCP instead.
|
||||
*/
|
||||
pptp = aps->aps_data;
|
||||
bzero((char *)pptp, sizeof(*pptp));
|
||||
ipn = &pptp->pptp_rule;
|
||||
ipn->in_size = size;
|
||||
ipn->in_ifps[0] = fin->fin_ifp;
|
||||
ipn->in_apr = NULL;
|
||||
ipn->in_use = 1;
|
||||
@ -137,6 +175,7 @@ ipf_p_pptp_new(arg, fin, aps, nat)
|
||||
ipn->in_nsrcmsk = 0xffffffff;
|
||||
ipn->in_odstmsk = 0xffffffff;
|
||||
ipn->in_ndstmsk = 0xffffffff;
|
||||
ipn->in_flags = (np->in_flags | IPN_PROXYRULE);
|
||||
MUTEX_INIT(&ipn->in_lock, "pptp proxy NAT rule");
|
||||
|
||||
ipn->in_namelen = np->in_namelen;
|
||||
@ -205,10 +244,9 @@ ipf_p_pptp_donatstate(fin, nat, pptp)
|
||||
#endif
|
||||
|
||||
MUTEX_ENTER(&softn->ipf_nat_new);
|
||||
nat2 = ipf_nat_add(&fi, &pptp->pptp_rule, &pptp->pptp_nat,
|
||||
nat2 = ipf_nat_add(&fi, pptp->pptp_rule, &pptp->pptp_nat,
|
||||
NAT_SLAVE, nat->nat_dir);
|
||||
MUTEX_EXIT(&softn->ipf_nat_new);
|
||||
pptp->pptp_nat = nat2;
|
||||
if (nat2 != NULL) {
|
||||
(void) ipf_nat_proto(&fi, nat2, 0);
|
||||
MUTEX_ENTER(&nat2->nat_lock);
|
||||
@ -538,6 +576,7 @@ ipf_p_pptp_del(softc, aps)
|
||||
|
||||
if (pptp->pptp_nat != NULL)
|
||||
ipf_nat_setpending(softc, pptp->pptp_nat);
|
||||
MUTEX_DESTROY(&pptp->pptp_rule.in_lock);
|
||||
pptp->pptp_rule->in_flags |= IPN_DELETE;
|
||||
ipf_nat_rule_deref(softc, &pptp->pptp_rule);
|
||||
}
|
||||
}
|
||||
|
11
external/bsd/ipf/dist/ip_rpcb_pxy.c
vendored
11
external/bsd/ipf/dist/ip_rpcb_pxy.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: ip_rpcb_pxy.c,v 1.1.1.1 2012/03/23 21:19:58 christos Exp $ */
|
||||
/* $NetBSD: ip_rpcb_pxy.c,v 1.1.1.2 2012/07/22 13:44:23 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2003 by Ryan Beasley <ryanb@goddamnbastard.org>
|
||||
* Copyright (C) 2002-2012 by Ryan Beasley <ryanb@goddamnbastard.org>
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*/
|
||||
@ -39,7 +39,7 @@
|
||||
* o The enclosed hack of STREAMS support is pretty sick and most likely
|
||||
* broken.
|
||||
*
|
||||
* Id
|
||||
* $Id: ip_rpcb_pxy.c,v 1.1.1.2 2012/07/22 13:44:23 darrenr Exp $
|
||||
*/
|
||||
#define IPF_RPCB_PROXY
|
||||
|
||||
@ -152,9 +152,11 @@ ipf_p_rpcb_new(arg, fin, aps, nat)
|
||||
{
|
||||
rpcb_session_t *rs;
|
||||
|
||||
fin = fin; /* LINT */
|
||||
nat = nat; /* LINT */
|
||||
|
||||
if (fin->fin_v != 4)
|
||||
return -1;
|
||||
|
||||
KMALLOC(rs, rpcb_session_t *);
|
||||
if (rs == NULL)
|
||||
return(-1);
|
||||
@ -1260,6 +1262,7 @@ ipf_p_rpcb_getnat(fin, nat, proto, port)
|
||||
return(-1);
|
||||
}
|
||||
|
||||
natl->nat_ptr = ipn;
|
||||
fi.fin_saddr = natl->nat_nsrcaddr;
|
||||
fi.fin_daddr = natl->nat_ndstaddr;
|
||||
ipn->in_use++;
|
||||
|
6
external/bsd/ipf/dist/ip_scan.h
vendored
6
external/bsd/ipf/dist/ip_scan.h
vendored
@ -1,12 +1,12 @@
|
||||
/* $NetBSD: ip_scan.h,v 1.1.1.1 2012/03/23 21:19:58 christos Exp $ */
|
||||
/* $NetBSD: ip_scan.h,v 1.1.1.2 2012/07/22 13:44:24 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2008 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* @(#)ip_fil.h 1.35 6/5/96
|
||||
* Id
|
||||
* $Id: ip_scan.h,v 1.1.1.2 2012/07/22 13:44:24 darrenr Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IP_SCAN_H__
|
||||
|
12
external/bsd/ipf/dist/ip_sync.c
vendored
12
external/bsd/ipf/dist/ip_sync.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: ip_sync.c,v 1.1.1.1 2012/03/23 21:19:59 christos Exp $ */
|
||||
/* $NetBSD: ip_sync.c,v 1.1.1.2 2012/07/22 13:44:24 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*/
|
||||
@ -98,7 +98,7 @@ struct file;
|
||||
/* END OF INCLUDES */
|
||||
|
||||
#if !defined(lint)
|
||||
static const char rcsid[] = "@(#)Id";
|
||||
static const char rcsid[] = "@(#)$Id: ip_sync.c,v 1.1.1.2 2012/07/22 13:44:24 darrenr Exp $";
|
||||
#endif
|
||||
|
||||
#define SYNC_STATETABSZ 256
|
||||
@ -158,8 +158,10 @@ ipf_sync_soft_create(softc)
|
||||
ipf_sync_softc_t *softs;
|
||||
|
||||
KMALLOC(softs, ipf_sync_softc_t *);
|
||||
if (softs == NULL)
|
||||
if (softs == NULL) {
|
||||
IPFERROR(110024);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bzero((char *)softs, sizeof(*softs));
|
||||
|
||||
@ -560,7 +562,7 @@ ipf_sync_write(softc, uio)
|
||||
if (softs->ipf_sync_debug > 2)
|
||||
printf("uiomove(data) %s %d bytes, got %d\n",
|
||||
"insufficient data, need",
|
||||
sh.sm_len, uio->uio_resid);
|
||||
sh.sm_len, (int)uio->uio_resid);
|
||||
IPFERROR(110007);
|
||||
return EAGAIN;
|
||||
}
|
||||
|
8
external/bsd/ipf/dist/ip_sync.h
vendored
8
external/bsd/ipf/dist/ip_sync.h
vendored
@ -1,12 +1,12 @@
|
||||
/* $NetBSD: ip_sync.h,v 1.1.1.1 2012/03/23 21:19:59 christos Exp $ */
|
||||
/* $NetBSD: ip_sync.h,v 1.1.1.2 2012/07/22 13:44:24 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2008 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* @(#)ip_fil.h 1.35 6/5/96
|
||||
* Id
|
||||
* $Id: ip_sync.h,v 1.1.1.2 2012/07/22 13:44:24 darrenr Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IP_SYNC_H__
|
||||
@ -120,4 +120,4 @@ extern void ipf_sync_expire __P((ipf_main_softc_t *));
|
||||
extern void ipf_sync_soft_destroy __P((ipf_main_softc_t *, void *));
|
||||
extern void *ipf_sync_soft_create __P((ipf_main_softc_t *));
|
||||
|
||||
#endif /* IP_SYNC */
|
||||
#endif /* __IP_SYNC_H__ */
|
||||
|
390
external/bsd/ipf/dist/ip_tftp_pxy.c
vendored
390
external/bsd/ipf/dist/ip_tftp_pxy.c
vendored
@ -1,43 +1,61 @@
|
||||
/* $NetBSD: ip_tftp_pxy.c,v 1.1.1.1 2012/03/23 21:19:59 christos Exp $ */
|
||||
/* $NetBSD: ip_tftp_pxy.c,v 1.1.1.2 2012/07/22 13:44:24 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id: ip_tftp_pxy.c,v 1.1.2.4 2012/01/26 05:44:25 darren_r Exp
|
||||
* $Id: ip_tftp_pxy.c,v 1.1.1.2 2012/07/22 13:44:24 darrenr Exp $
|
||||
*/
|
||||
|
||||
#define IPF_TFTP_PROXY
|
||||
|
||||
typedef struct ipf_tftp_softc_s {
|
||||
int ipf_p_tftp_readonly;
|
||||
ipftuneable_t *ipf_p_tftp_tune;
|
||||
} ipf_tftp_softc_t;
|
||||
|
||||
int ipf_p_tftp_backchannel __P((fr_info_t *, ap_session_t *, nat_t *));
|
||||
int ipf_p_tftp_client __P((ipf_tftp_softc_t *, fr_info_t *, ap_session_t *,
|
||||
nat_t *));
|
||||
int ipf_p_tftp_in __P((void *, fr_info_t *, ap_session_t *, nat_t *));
|
||||
void ipf_p_tftp_main_load __P((void));
|
||||
void ipf_p_tftp_main_unload __P((void));
|
||||
int ipf_p_tftp_new __P((void *, fr_info_t *, ap_session_t *, nat_t *));
|
||||
void ipf_p_tftp_del __P((ipf_main_softc_t *, ap_session_t *));
|
||||
int ipf_p_tftp_out __P((void *, fr_info_t *, ap_session_t *, nat_t *));
|
||||
int ipf_p_tftp_in __P((void *, fr_info_t *, ap_session_t *, nat_t *));
|
||||
int ipf_p_tftp_client __P((fr_info_t *, ap_session_t *, nat_t *));
|
||||
int ipf_p_tftp_server __P((fr_info_t *, ap_session_t *, nat_t *));
|
||||
int ipf_p_tftp_backchannel __P((fr_info_t *, ap_session_t *, nat_t *));
|
||||
int ipf_p_tftp_server __P((ipf_tftp_softc_t *, fr_info_t *, ap_session_t *,
|
||||
nat_t *));
|
||||
void *ipf_p_tftp_soft_create __P((ipf_main_softc_t *));
|
||||
void ipf_p_tftp_soft_destroy __P((ipf_main_softc_t *, void *));
|
||||
|
||||
static frentry_t tftpfr;
|
||||
static int tftp_proxy_init = 0;
|
||||
|
||||
int tftp_proxy_init = 0;
|
||||
typedef enum tftp_cmd_e {
|
||||
TFTP_CMD_READ = 1,
|
||||
TFTP_CMD_WRITE = 2,
|
||||
TFTP_CMD_DATA = 3,
|
||||
TFTP_CMD_ACK = 4,
|
||||
TFTP_CMD_ERROR = 5
|
||||
} tftp_cmd_t;
|
||||
|
||||
typedef struct tftpinfo {
|
||||
nat_t *ti_datanat;
|
||||
ipstate_t *ti_datastate;
|
||||
int ti_lastcmd;
|
||||
int ti_nextblk;
|
||||
int ti_lastblk;
|
||||
int ti_lasterror;
|
||||
char ti_filename[80];
|
||||
tftp_cmd_t ti_lastcmd;
|
||||
int ti_nextblk;
|
||||
int ti_lastblk;
|
||||
int ti_lasterror;
|
||||
char ti_filename[80];
|
||||
ipnat_t *ti_rule;
|
||||
} tftpinfo_t;
|
||||
|
||||
#define TFTP_CMD_READ 1
|
||||
#define TFTP_CMD_WRITE 2
|
||||
#define TFTP_CMD_DATA 3
|
||||
#define TFTP_CMD_ACK 4
|
||||
#define TFTP_CMD_ERROR 5
|
||||
static ipftuneable_t ipf_tftp_tuneables[] = {
|
||||
{ { (void *)offsetof(ipf_tftp_softc_t, ipf_p_tftp_readonly) },
|
||||
"tftp_read_only", 0, 1,
|
||||
stsizeof(ipf_tftp_softc_t, ipf_p_tftp_readonly),
|
||||
0, NULL, NULL },
|
||||
{ { NULL }, NULL, 0, 0, 0, 0, NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
@ -66,6 +84,53 @@ ipf_p_tftp_main_unload()
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
ipf_p_tftp_soft_create(softc)
|
||||
ipf_main_softc_t *softc;
|
||||
{
|
||||
ipf_tftp_softc_t *softt;
|
||||
|
||||
KMALLOC(softt, ipf_tftp_softc_t *);
|
||||
if (softt == NULL)
|
||||
return NULL;
|
||||
|
||||
bzero((char *)softt, sizeof(*softt));
|
||||
|
||||
softt->ipf_p_tftp_tune = ipf_tune_array_copy(softt,
|
||||
sizeof(ipf_tftp_tuneables),
|
||||
ipf_tftp_tuneables);
|
||||
if (softt->ipf_p_tftp_tune == NULL) {
|
||||
ipf_p_tftp_soft_destroy(softc, softt);
|
||||
return NULL;
|
||||
}
|
||||
if (ipf_tune_array_link(softc, softt->ipf_p_tftp_tune) == -1) {
|
||||
ipf_p_tftp_soft_destroy(softc, softt);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
softt->ipf_p_tftp_readonly = 1;
|
||||
|
||||
return softt;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ipf_p_tftp_soft_destroy(softc, arg)
|
||||
ipf_main_softc_t *softc;
|
||||
void *arg;
|
||||
{
|
||||
ipf_tftp_softc_t *softt = arg;
|
||||
|
||||
if (softt->ipf_p_tftp_tune != NULL) {
|
||||
ipf_tune_array_unlink(softc, softt->ipf_p_tftp_tune);
|
||||
KFREES(softt->ipf_p_tftp_tune, sizeof(ipf_tftp_tuneables));
|
||||
softt->ipf_p_tftp_tune = NULL;
|
||||
}
|
||||
|
||||
KFREE(softt);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ipf_p_tftp_out(arg, fin, aps, nat)
|
||||
void *arg;
|
||||
@ -73,10 +138,12 @@ ipf_p_tftp_out(arg, fin, aps, nat)
|
||||
ap_session_t *aps;
|
||||
nat_t *nat;
|
||||
{
|
||||
ipf_tftp_softc_t *softt = arg;
|
||||
|
||||
fin->fin_flx |= FI_NOWILD;
|
||||
if (nat->nat_dir == NAT_OUTBOUND)
|
||||
return ipf_p_tftp_client(fin, aps, nat);
|
||||
return ipf_p_tftp_server(fin, aps, nat);
|
||||
return ipf_p_tftp_client(softt, fin, aps, nat);
|
||||
return ipf_p_tftp_server(softt, fin, aps, nat);
|
||||
}
|
||||
|
||||
|
||||
@ -87,10 +154,12 @@ ipf_p_tftp_in(arg, fin, aps, nat)
|
||||
ap_session_t *aps;
|
||||
nat_t *nat;
|
||||
{
|
||||
ipf_tftp_softc_t *softt = arg;
|
||||
|
||||
fin->fin_flx |= FI_NOWILD;
|
||||
if (nat->nat_dir == NAT_INBOUND)
|
||||
return ipf_p_tftp_client(fin, aps, nat);
|
||||
return ipf_p_tftp_server(fin, aps, nat);
|
||||
return ipf_p_tftp_client(softt, fin, aps, nat);
|
||||
return ipf_p_tftp_server(softt, fin, aps, nat);
|
||||
}
|
||||
|
||||
|
||||
@ -103,25 +172,112 @@ ipf_p_tftp_new(arg, fin, aps, nat)
|
||||
{
|
||||
udphdr_t *udp;
|
||||
tftpinfo_t *ti;
|
||||
ipnat_t *ipn;
|
||||
ipnat_t *np;
|
||||
int size;
|
||||
|
||||
fin = fin; /* LINT */
|
||||
|
||||
np = nat->nat_ptr;
|
||||
size = np->in_size;
|
||||
|
||||
KMALLOC(ti, tftpinfo_t *);
|
||||
if (ti == NULL)
|
||||
return -1;
|
||||
KMALLOCS(ipn, ipnat_t *, size);
|
||||
if (ipn == NULL) {
|
||||
KFREE(ti);
|
||||
return -1;
|
||||
}
|
||||
|
||||
aps->aps_data = ti;
|
||||
aps->aps_psiz = sizeof(*ti);
|
||||
ti->ti_lastcmd = 0;
|
||||
|
||||
nat = nat; /* LINT */
|
||||
fin = fin; /* LINT */
|
||||
bzero((char *)ti, sizeof(*ti));
|
||||
bzero((char *)ipn, size);
|
||||
ti->ti_rule = ipn;
|
||||
|
||||
udp = (udphdr_t *)fin->fin_dp;
|
||||
aps->aps_sport = udp->uh_sport;
|
||||
aps->aps_dport = udp->uh_dport;
|
||||
|
||||
ipn->in_size = size;
|
||||
ipn->in_apr = NULL;
|
||||
ipn->in_use = 1;
|
||||
ipn->in_hits = 1;
|
||||
ipn->in_ippip = 1;
|
||||
ipn->in_pr[0] = IPPROTO_UDP;
|
||||
ipn->in_pr[1] = IPPROTO_UDP;
|
||||
ipn->in_ifps[0] = nat->nat_ifps[0];
|
||||
ipn->in_ifps[1] = nat->nat_ifps[1];
|
||||
ipn->in_v[0] = nat->nat_ptr->in_v[1];
|
||||
ipn->in_v[1] = nat->nat_ptr->in_v[0];
|
||||
ipn->in_flags = IPN_UDP|IPN_FIXEDDPORT|IPN_PROXYRULE;
|
||||
|
||||
ipn->in_nsrcip6 = nat->nat_odst6;
|
||||
ipn->in_osrcip6 = nat->nat_ndst6;
|
||||
|
||||
if ((np->in_redir & NAT_REDIRECT) != 0) {
|
||||
ipn->in_redir = NAT_MAP;
|
||||
if (ipn->in_v[0] == 4) {
|
||||
ipn->in_snip = ntohl(nat->nat_odstaddr);
|
||||
ipn->in_dnip = ntohl(nat->nat_nsrcaddr);
|
||||
} else {
|
||||
#ifdef USE_INET6
|
||||
ipn->in_snip6 = nat->nat_odst6;
|
||||
ipn->in_dnip6 = nat->nat_nsrc6;
|
||||
#endif
|
||||
}
|
||||
ipn->in_ndstip6 = nat->nat_nsrc6;
|
||||
ipn->in_odstip6 = nat->nat_osrc6;
|
||||
} else {
|
||||
ipn->in_redir = NAT_REDIRECT;
|
||||
if (ipn->in_v[0] == 4) {
|
||||
ipn->in_snip = ntohl(nat->nat_odstaddr);
|
||||
ipn->in_dnip = ntohl(nat->nat_osrcaddr);
|
||||
} else {
|
||||
#ifdef USE_INET6
|
||||
ipn->in_snip6 = nat->nat_odst6;
|
||||
ipn->in_dnip6 = nat->nat_osrc6;
|
||||
#endif
|
||||
}
|
||||
ipn->in_ndstip6 = nat->nat_osrc6;
|
||||
ipn->in_odstip6 = nat->nat_nsrc6;
|
||||
}
|
||||
ipn->in_odport = htons(fin->fin_sport);
|
||||
ipn->in_ndport = htons(fin->fin_sport);
|
||||
|
||||
IP6_SETONES(&ipn->in_osrcmsk6);
|
||||
IP6_SETONES(&ipn->in_nsrcmsk6);
|
||||
IP6_SETONES(&ipn->in_odstmsk6);
|
||||
IP6_SETONES(&ipn->in_ndstmsk6);
|
||||
MUTEX_INIT(&ipn->in_lock, "tftp proxy NAT rule");
|
||||
|
||||
ipn->in_namelen = np->in_namelen;
|
||||
bcopy(np->in_names, ipn->in_ifnames, ipn->in_namelen);
|
||||
ipn->in_ifnames[0] = np->in_ifnames[0];
|
||||
ipn->in_ifnames[1] = np->in_ifnames[1];
|
||||
|
||||
ti->ti_lastcmd = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ipf_p_tftp_del(softc, aps)
|
||||
ipf_main_softc_t *softc;
|
||||
ap_session_t *aps;
|
||||
{
|
||||
tftpinfo_t *tftp;
|
||||
|
||||
tftp = aps->aps_data;
|
||||
if (tftp != NULL) {
|
||||
tftp->ti_rule->in_flags |= IPN_DELETE;
|
||||
ipf_nat_rule_deref(softc, &tftp->ti_rule);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Setup for a new TFTP proxy.
|
||||
*/
|
||||
@ -135,14 +291,21 @@ ipf_p_tftp_backchannel(fin, aps, nat)
|
||||
#ifdef USE_MUTEXES
|
||||
ipf_nat_softc_t *softn = softc->ipf_nat_soft;
|
||||
#endif
|
||||
struct in_addr swip,swip2;
|
||||
#ifdef USE_INET6
|
||||
i6addr_t swip6, sw2ip6;
|
||||
ip6_t *ip6;
|
||||
#endif
|
||||
struct in_addr swip, sw2ip;
|
||||
tftpinfo_t *ti;
|
||||
udphdr_t *udp;
|
||||
udphdr_t udp;
|
||||
fr_info_t fi;
|
||||
u_short slen;
|
||||
nat_t *nat2;
|
||||
int nflags;
|
||||
ip_t *ip;
|
||||
int dir;
|
||||
|
||||
ti = aps->aps_data;
|
||||
udp = (udphdr_t *)fin->fin_dp;
|
||||
/*
|
||||
* Add skeleton NAT entry for connection which will come back the
|
||||
* other way.
|
||||
@ -150,68 +313,114 @@ ipf_p_tftp_backchannel(fin, aps, nat)
|
||||
bcopy((char *)fin, (char *)&fi, sizeof(fi));
|
||||
fi.fin_flx |= FI_IGNORE;
|
||||
fi.fin_data[1] = 0;
|
||||
if (nat->nat_dir == NAT_OUTBOUND)
|
||||
nat2 = ipf_nat_outlookup(&fi, NAT_SEARCH|IPN_UDP,
|
||||
nat->nat_pr[0], nat->nat_osrcip,
|
||||
nat->nat_odstip);
|
||||
else
|
||||
nat2 = ipf_nat_inlookup(&fi, NAT_SEARCH|IPN_UDP,
|
||||
nat->nat_pr[0], nat->nat_nsrcip,
|
||||
nat->nat_odstip);
|
||||
if (nat2 == NULL) {
|
||||
u_short slen;
|
||||
int nflags;
|
||||
ip_t *ip;
|
||||
|
||||
ip = fin->fin_ip;
|
||||
bzero((char *)&udp, sizeof(udp));
|
||||
udp.uh_sport = 0; /* XXX - don't specify remote port */
|
||||
udp.uh_dport = ti->ti_rule->in_ndport;
|
||||
udp.uh_ulen = htons(sizeof(udp));
|
||||
udp.uh_sum = 0;
|
||||
|
||||
fi.fin_fr = &tftpfr;
|
||||
fi.fin_dp = (char *)&udp;
|
||||
fi.fin_sport = 0;
|
||||
fi.fin_dport = ntohs(ti->ti_rule->in_ndport);
|
||||
fi.fin_dlen = sizeof(udp);
|
||||
fi.fin_plen = fi.fin_hlen + sizeof(udp);
|
||||
fi.fin_flx &= FI_LOWTTL|FI_FRAG|FI_TCPUDP|FI_OPTIONS|FI_IGNORE;
|
||||
nflags = NAT_SLAVE|IPN_UDP|SI_W_SPORT;
|
||||
#ifdef USE_INET6
|
||||
ip6 = (ip6_t *)fin->fin_ip;
|
||||
#endif
|
||||
ip = fin->fin_ip;
|
||||
sw2ip.s_addr = 0;
|
||||
swip.s_addr = 0;
|
||||
|
||||
fi.fin_src6 = nat->nat_ndst6;
|
||||
fi.fin_dst6 = nat->nat_nsrc6;
|
||||
if (nat->nat_v[0] == 4) {
|
||||
slen = ip->ip_len;
|
||||
ip->ip_len = htons(fin->fin_hlen + sizeof(*udp));
|
||||
bzero((char *)udp, sizeof(*udp));
|
||||
udp->uh_sport = htons(fi.fin_data[0]);
|
||||
udp->uh_dport = 0; /* XXX - don't specify remote port */
|
||||
udp->uh_ulen = 0;
|
||||
udp->uh_sum = 0;
|
||||
fi.fin_dp = (char *)udp;
|
||||
fi.fin_fr = &tftpfr;
|
||||
fi.fin_dlen = sizeof(*udp);
|
||||
fi.fin_plen = fi.fin_hlen + sizeof(*udp);
|
||||
fi.fin_flx &= FI_LOWTTL|FI_FRAG|FI_TCPUDP|FI_OPTIONS|FI_IGNORE;
|
||||
nflags = NAT_SLAVE|IPN_UDP|SI_W_DPORT;
|
||||
|
||||
ip->ip_len = htons(fin->fin_hlen + sizeof(udp));
|
||||
swip = ip->ip_src;
|
||||
swip2 = ip->ip_dst;
|
||||
fi.fin_fi.fi_saddr = nat->nat_osrcaddr;
|
||||
ip->ip_src = nat->nat_osrcip;
|
||||
fi.fin_fi.fi_daddr = nat->nat_odstaddr;
|
||||
ip->ip_dst = nat->nat_odstip;
|
||||
sw2ip = ip->ip_dst;
|
||||
ip->ip_src = nat->nat_ndstip;
|
||||
ip->ip_dst = nat->nat_nsrcip;
|
||||
} else {
|
||||
#ifdef USE_INET6
|
||||
slen = ip6->ip6_plen;
|
||||
ip6->ip6_plen = htons(sizeof(udp));
|
||||
swip6.in6 = ip6->ip6_src;
|
||||
sw2ip6.in6 = ip6->ip6_dst;
|
||||
ip6->ip6_src = nat->nat_ndst6.in6;
|
||||
ip6->ip6_dst = nat->nat_nsrc6.in6;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (nat->nat_dir == NAT_INBOUND)
|
||||
nflags |= NAT_NOTRULEPORT;
|
||||
if (nat->nat_dir == NAT_INBOUND) {
|
||||
dir = NAT_OUTBOUND;
|
||||
fi.fin_out = 1;
|
||||
} else {
|
||||
dir = NAT_INBOUND;
|
||||
fi.fin_out = 0;
|
||||
}
|
||||
nflags |= NAT_NOTRULEPORT;
|
||||
|
||||
MUTEX_ENTER(&softn->ipf_nat_new);
|
||||
nat2 = ipf_nat_add(&fi, nat->nat_ptr, &ti->ti_datanat,
|
||||
nflags, nat->nat_dir);
|
||||
MUTEX_EXIT(&softn->ipf_nat_new);
|
||||
if (nat2 != NULL) {
|
||||
(void) ipf_nat_proto(&fi, nat2, IPN_UDP);
|
||||
ipf_nat_update(&fi, nat2);
|
||||
fi.fin_ifp = NULL;
|
||||
if (ipf_state_add(softc, &fi, &ti->ti_datastate,
|
||||
SI_W_DPORT) != 0) {
|
||||
ipf_nat_setpending(softc, nat2);
|
||||
MUTEX_ENTER(&softn->ipf_nat_new);
|
||||
if (nat->nat_v[0] == 4)
|
||||
nat2 = ipf_nat_add(&fi, ti->ti_rule, NULL, nflags, dir);
|
||||
else
|
||||
nat2 = ipf_nat6_add(&fi, ti->ti_rule, NULL, nflags, dir);
|
||||
MUTEX_EXIT(&softn->ipf_nat_new);
|
||||
if (nat2 != NULL) {
|
||||
(void) ipf_nat_proto(&fi, nat2, IPN_UDP);
|
||||
ipf_nat_update(&fi, nat2);
|
||||
fi.fin_ifp = NULL;
|
||||
if (ti->ti_rule->in_redir == NAT_MAP) {
|
||||
fi.fin_src6 = nat->nat_ndst6;
|
||||
fi.fin_dst6 = nat->nat_nsrc6;
|
||||
if (nat->nat_v[0] == 4) {
|
||||
ip->ip_src = nat->nat_ndstip;
|
||||
ip->ip_dst = nat->nat_nsrcip;
|
||||
} else {
|
||||
#ifdef USE_INET6
|
||||
ip6->ip6_src = nat->nat_ndst6.in6;
|
||||
ip6->ip6_dst = nat->nat_nsrc6.in6;
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
fi.fin_src6 = nat->nat_odst6;
|
||||
fi.fin_dst6 = nat->nat_osrc6;
|
||||
if (fin->fin_v == 4) {
|
||||
ip->ip_src = nat->nat_odstip;
|
||||
ip->ip_dst = nat->nat_osrcip;
|
||||
} else {
|
||||
#ifdef USE_INET6
|
||||
ip6->ip6_src = nat->nat_odst6.in6;
|
||||
ip6->ip6_dst = nat->nat_osrc6.in6;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (ipf_state_add(softc, &fi, NULL, SI_W_SPORT) != 0) {
|
||||
ipf_nat_setpending(softc, nat2);
|
||||
}
|
||||
}
|
||||
if (nat->nat_v[0] == 4) {
|
||||
ip->ip_len = slen;
|
||||
ip->ip_src = swip;
|
||||
ip->ip_dst = swip2;
|
||||
return 0;
|
||||
ip->ip_dst = sw2ip;
|
||||
} else {
|
||||
#ifdef USE_INET6
|
||||
ip6->ip6_plen = slen;
|
||||
ip6->ip6_src = swip6.in6;
|
||||
ip6->ip6_dst = sw2ip6.in6;
|
||||
#endif
|
||||
}
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ipf_p_tftp_client(fin, aps, nat)
|
||||
ipf_p_tftp_client(softt, fin, aps, nat)
|
||||
ipf_tftp_softc_t *softt;
|
||||
fr_info_t *fin;
|
||||
ap_session_t *aps;
|
||||
nat_t *nat;
|
||||
@ -229,13 +438,15 @@ ipf_p_tftp_client(fin, aps, nat)
|
||||
msg = fin->fin_dp;
|
||||
msg += sizeof(udphdr_t);
|
||||
opcode = (msg[0] << 8) | msg[1];
|
||||
DT3(tftp_cmd, fr_info_t *, fin, int, opcode, nat_t *, nat);
|
||||
|
||||
switch (opcode)
|
||||
{
|
||||
case TFTP_CMD_READ :
|
||||
case TFTP_CMD_WRITE :
|
||||
if (fin->fin_out != 0)
|
||||
return -1;
|
||||
if (softt->ipf_p_tftp_readonly != 0)
|
||||
break;
|
||||
/* FALLTHROUGH */
|
||||
case TFTP_CMD_READ :
|
||||
len = fin->fin_dlen - sizeof(*udp) - 2;
|
||||
if (len > sizeof(ti->ti_filename) - 1)
|
||||
len = sizeof(ti->ti_filename) - 1;
|
||||
@ -245,6 +456,7 @@ ipf_p_tftp_client(fin, aps, nat)
|
||||
if (*s == '\0')
|
||||
break;
|
||||
}
|
||||
ipf_p_tftp_backchannel(fin, aps, nat);
|
||||
break;
|
||||
default :
|
||||
return -1;
|
||||
@ -257,7 +469,8 @@ ipf_p_tftp_client(fin, aps, nat)
|
||||
|
||||
|
||||
int
|
||||
ipf_p_tftp_server(fin, aps, nat)
|
||||
ipf_p_tftp_server(softt, fin, aps, nat)
|
||||
ipf_tftp_softc_t *softt;
|
||||
fr_info_t *fin;
|
||||
ap_session_t *aps;
|
||||
nat_t *nat;
|
||||
@ -279,20 +492,13 @@ ipf_p_tftp_server(fin, aps, nat)
|
||||
switch (opcode)
|
||||
{
|
||||
case TFTP_CMD_ACK :
|
||||
/* This proxy should not see any ACKS for DATA blocks */
|
||||
if (fin->fin_out != 1)
|
||||
return -1;
|
||||
if ((arg == 0) &&
|
||||
(ti->ti_lastcmd == TFTP_CMD_READ ||
|
||||
ti->ti_lastcmd == TFTP_CMD_WRITE))
|
||||
ipf_p_tftp_backchannel(fin, aps, nat);
|
||||
ti->ti_lastblk = arg;
|
||||
break;
|
||||
|
||||
case TFTP_CMD_ERROR :
|
||||
if (fin->fin_out != 1)
|
||||
return -1;
|
||||
ti->ti_lasterror = arg;
|
||||
break;
|
||||
|
||||
default :
|
||||
return -1;
|
||||
}
|
||||
|
23
external/bsd/ipf/dist/ipf.h
vendored
23
external/bsd/ipf/dist/ipf.h
vendored
@ -1,12 +1,12 @@
|
||||
/* $NetBSD: ipf.h,v 1.1.1.1 2012/03/23 21:20:00 christos Exp $ */
|
||||
/* $NetBSD: ipf.h,v 1.1.1.2 2012/07/22 13:44:25 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* @(#)ipf.h 1.12 6/5/96
|
||||
* Id
|
||||
* $Id: ipf.h,v 1.1.1.2 2012/07/22 13:44:25 darrenr Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IPF_H__
|
||||
@ -200,7 +200,7 @@ typedef int (* ioctlfunc_t) __P((int, ioctlcmd_t, ...));
|
||||
#else
|
||||
typedef int (* ioctlfunc_t) __P((dev_t, ioctlcmd_t, void *));
|
||||
#endif
|
||||
typedef void (* addfunc_t) __P((int, ioctlfunc_t, void *));
|
||||
typedef int (* addfunc_t) __P((int, ioctlfunc_t, void *));
|
||||
typedef int (* copyfunc_t) __P((void *, void *, size_t));
|
||||
|
||||
|
||||
@ -262,17 +262,18 @@ extern u_32_t getv6optbyvalue __P((int));
|
||||
extern char *icmptypename __P((int, int));
|
||||
extern void initparse __P((void));
|
||||
extern void ipf_dotuning __P((int, char *, ioctlfunc_t));
|
||||
extern void ipf_addrule __P((int, ioctlfunc_t, void *));
|
||||
extern int ipf_addrule __P((int, ioctlfunc_t, void *));
|
||||
extern void ipf_mutex_clean __P((void));
|
||||
extern int ipf_parsefile __P((int, addfunc_t, ioctlfunc_t *, char *));
|
||||
extern int ipf_parsesome __P((int, addfunc_t, ioctlfunc_t *, FILE *));
|
||||
extern void ipf_perror __P((int, char *));
|
||||
extern int ipf_perror_fd __P(( int, ioctlfunc_t, char *));
|
||||
extern void ipf_rwlock_clean __P((void));
|
||||
extern char *ipf_strerror __P((int));
|
||||
extern void ipferror __P((int, char *));
|
||||
extern int ipmon_parsefile __P((char *));
|
||||
extern int ipmon_parsesome __P((FILE *));
|
||||
extern void ipnat_addrule __P((int, ioctlfunc_t, void *));
|
||||
extern int ipnat_addrule __P((int, ioctlfunc_t, void *));
|
||||
extern int ipnat_parsefile __P((int, addfunc_t, ioctlfunc_t, char *));
|
||||
extern int ipnat_parsesome __P((int, addfunc_t, ioctlfunc_t, FILE *));
|
||||
extern int ippool_parsefile __P((int, char *, ioctlfunc_t));
|
||||
@ -281,7 +282,7 @@ extern int kmemcpywrap __P((void *, void *, size_t));
|
||||
extern char *kvatoname __P((ipfunc_t, ioctlfunc_t));
|
||||
extern int load_dstlist __P((struct ippool_dst *, ioctlfunc_t,
|
||||
ipf_dstnode_t *));
|
||||
extern int load_dstlistnode __P((int, char *, struct ipf_dstnode *, int,
|
||||
extern int load_dstlistnode __P((int, char *, struct ipf_dstnode *,
|
||||
ioctlfunc_t));
|
||||
extern alist_t *load_file __P((char *));
|
||||
extern int load_hash __P((struct iphtable_s *, struct iphtent_s *,
|
||||
@ -302,12 +303,13 @@ extern wordtab_t *parsefields __P((wordtab_t *, char *));
|
||||
extern int *parseipfexpr __P((char *, char **));
|
||||
extern int parsewhoisline __P((char *, addrfamily_t *, addrfamily_t *));
|
||||
extern void pool_close __P((void));
|
||||
extern int pool_fd __P((void));
|
||||
extern int pool_ioctl __P((ioctlfunc_t, ioctlcmd_t, void *));
|
||||
extern int pool_open __P((void));
|
||||
extern char *portname __P((int, int));
|
||||
extern int pri_findname __P((char *));
|
||||
extern char *pri_toname __P((int));
|
||||
extern void print_toif __P((char *, char *, struct frdest *));
|
||||
extern void print_toif __P((int, char *, char *, struct frdest *));
|
||||
extern void printaps __P((ap_session_t *, int, int));
|
||||
extern void printaddr __P((int, int, char *, int, u_32_t *, u_32_t *));
|
||||
extern void printbuf __P((char *, int, int));
|
||||
@ -331,7 +333,7 @@ extern void printlookup __P((char *, i6addr_t *addr, i6addr_t *mask));
|
||||
extern void printmask __P((int, u_32_t *));
|
||||
extern void printnataddr __P((int, char *, nat_addr_t *, int));
|
||||
extern void printnatfield __P((nat_t *, int));
|
||||
extern void printnatside __P((char *, natstat_t *, nat_stat_side_t *));
|
||||
extern void printnatside __P((char *, nat_stat_side_t *));
|
||||
extern void printpacket __P((int, mb_t *));
|
||||
extern void printpacket6 __P((int, mb_t *));
|
||||
extern struct ippool_dst *printdstlist __P((struct ippool_dst *, copyfunc_t,
|
||||
@ -363,7 +365,6 @@ extern int remove_hash __P((struct iphtable_s *, ioctlfunc_t));
|
||||
extern int remove_hashnode __P((int, char *, struct iphtent_s *, ioctlfunc_t));
|
||||
extern int remove_pool __P((ip_pool_t *, ioctlfunc_t));
|
||||
extern int remove_poolnode __P((int, char *, ip_pool_node_t *, ioctlfunc_t));
|
||||
extern u_char tcp_flags __P((char *, u_char *, int));
|
||||
extern u_char tcpflags __P((char *));
|
||||
extern void printc __P((struct frentry *));
|
||||
extern void printC __P((int));
|
||||
@ -384,7 +385,7 @@ extern void printipfexpr __P((int *));
|
||||
extern void printstatefield __P((ipstate_t *, int));
|
||||
extern void printstatefieldhdr __P((int));
|
||||
extern int sendtrap_v1_0 __P((int, char *, char *, int, time_t));
|
||||
extern int sendtrap_v2_0 __P((int, char *, char *, int, time_t));
|
||||
extern int sendtrap_v2_0 __P((int, char *, char *, int));
|
||||
extern int vtof __P((int));
|
||||
|
||||
extern void set_variable __P((char *, char *));
|
||||
|
4
external/bsd/ipf/dist/ipf_rb.h
vendored
4
external/bsd/ipf/dist/ipf_rb.h
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: ipf_rb.h,v 1.1.1.1 2012/03/23 21:20:01 christos Exp $ */
|
||||
/* $NetBSD: ipf_rb.h,v 1.1.1.2 2012/07/22 13:44:25 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
|
4
external/bsd/ipf/dist/iplang/iplang.h
vendored
4
external/bsd/ipf/dist/iplang/iplang.h
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: iplang.h,v 1.1.1.1 2012/03/23 21:20:05 christos Exp $ */
|
||||
/* $NetBSD: iplang.h,v 1.1.1.2 2012/07/22 13:44:33 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*/
|
||||
|
6
external/bsd/ipf/dist/iplang/iplang_l.l
vendored
6
external/bsd/ipf/dist/iplang/iplang_l.l
vendored
@ -1,12 +1,12 @@
|
||||
/* $NetBSD: iplang_l.l,v 1.1.1.1 2012/03/23 21:20:05 christos Exp $ */
|
||||
/* $NetBSD: iplang_l.l,v 1.1.1.2 2012/07/22 13:44:33 darrenr Exp $ */
|
||||
|
||||
%{
|
||||
/*
|
||||
* Copyright (C) 2003 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: iplang_l.l,v 1.1.1.2 2012/07/22 13:44:33 darrenr Exp $
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
10
external/bsd/ipf/dist/iplang/iplang_y.y
vendored
10
external/bsd/ipf/dist/iplang/iplang_y.y
vendored
@ -1,12 +1,12 @@
|
||||
/* $NetBSD: iplang_y.y,v 1.1.1.1 2012/03/23 21:20:05 christos Exp $ */
|
||||
/* $NetBSD: iplang_y.y,v 1.1.1.2 2012/07/22 13:44:34 darrenr Exp $ */
|
||||
|
||||
%{
|
||||
/*
|
||||
* Copyright (C) 2008 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: iplang_y.y,v 1.1.1.2 2012/07/22 13:44:34 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -1325,7 +1325,7 @@ void packet_done()
|
||||
sprintf((char *)t, " ");
|
||||
t += 8;
|
||||
for (k = 16; k; k--, s++)
|
||||
*t++ = (ISPRINT(*s) ? *s : '.');
|
||||
*t++ = (isprint(*s) ? *s : '.');
|
||||
s--;
|
||||
}
|
||||
|
||||
@ -1343,7 +1343,7 @@ void packet_done()
|
||||
t += 7;
|
||||
s -= j & 0xf;
|
||||
for (k = j & 0xf; k; k--, s++)
|
||||
*t++ = (ISPRINT(*s) ? *s : '.');
|
||||
*t++ = (isprint(*s) ? *s : '.');
|
||||
*t++ = '\n';
|
||||
*t = '\0';
|
||||
}
|
||||
|
27
external/bsd/ipf/dist/ipmon.h
vendored
27
external/bsd/ipf/dist/ipmon.h
vendored
@ -1,12 +1,12 @@
|
||||
/* $NetBSD: ipmon.h,v 1.1.1.1 2012/03/23 21:20:00 christos Exp $ */
|
||||
/* $NetBSD: ipmon.h,v 1.1.1.2 2012/07/22 13:44:25 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* @(#)ip_fil.h 1.35 6/5/96
|
||||
* Id
|
||||
* $Id: ipmon.h,v 1.1.1.2 2012/07/22 13:44:25 darrenr Exp $
|
||||
*/
|
||||
|
||||
typedef struct ipmon_msg_s {
|
||||
@ -18,14 +18,21 @@ typedef struct ipmon_msg_s {
|
||||
int imm_loglevel;
|
||||
} ipmon_msg_t;
|
||||
|
||||
typedef void (*ims_destroy_func_t)(void *);
|
||||
typedef void *(*ims_dup_func_t)(void *);
|
||||
typedef int (*ims_match_func_t)(void *, void *);
|
||||
typedef void *(*ims_parse_func_t)(char **);
|
||||
typedef void (*ims_print_func_t)(void *);
|
||||
typedef int (*ims_store_func_t)(void *, ipmon_msg_t *);
|
||||
|
||||
typedef struct ipmon_saver_s {
|
||||
char *ims_name;
|
||||
void (*ims_destroy)(void *);
|
||||
void * (*ims_dup)(void *);
|
||||
int (*ims_match)(void *, void *);
|
||||
void * (* ims_parse)(char **);
|
||||
void (*ims_print)(void *);
|
||||
int (*ims_store)(void *, ipmon_msg_t *);
|
||||
char *ims_name;
|
||||
ims_destroy_func_t ims_destroy;
|
||||
ims_dup_func_t ims_dup;
|
||||
ims_match_func_t ims_match;
|
||||
ims_parse_func_t ims_parse;
|
||||
ims_print_func_t ims_print;
|
||||
ims_store_func_t ims_store;
|
||||
} ipmon_saver_t;
|
||||
|
||||
typedef struct ipmon_saver_int_s {
|
||||
|
4
external/bsd/ipf/dist/ipsd/ipsd.c
vendored
4
external/bsd/ipf/dist/ipsd/ipsd.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ipsd.c,v 1.1.1.1 2012/03/23 21:20:05 christos Exp $ */
|
||||
/* $NetBSD: ipsd.c,v 1.1.1.2 2012/07/22 13:44:34 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* (C)opyright 1995-1998 Darren Reed.
|
||||
@ -34,7 +34,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char sccsid[] = "@(#)ipsd.c 1.3 12/3/95 (C)1995 Darren Reed";
|
||||
static const char rcsid[] = "@(#)Id";
|
||||
static const char rcsid[] = "@(#)$Id: ipsd.c,v 1.1.1.2 2012/07/22 13:44:34 darrenr Exp $";
|
||||
#endif
|
||||
|
||||
extern char *optarg;
|
||||
|
4
external/bsd/ipf/dist/ipsd/ipsdr.c
vendored
4
external/bsd/ipf/dist/ipsd/ipsdr.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ipsdr.c,v 1.1.1.1 2012/03/23 21:20:06 christos Exp $ */
|
||||
/* $NetBSD: ipsdr.c,v 1.1.1.2 2012/07/22 13:44:34 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* (C)opyright 1995-1998 Darren Reed.
|
||||
@ -35,7 +35,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char sccsid[] = "@(#)ipsdr.c 1.3 12/3/95 (C)1995 Darren Reed";
|
||||
static const char rcsid[] = "@(#)Id";
|
||||
static const char rcsid[] = "@(#)$Id: ipsdr.c,v 1.1.1.2 2012/07/22 13:44:34 darrenr Exp $";
|
||||
#endif
|
||||
|
||||
extern char *optarg;
|
||||
|
4
external/bsd/ipf/dist/ipsd/linux.h
vendored
4
external/bsd/ipf/dist/ipsd/linux.h
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: linux.h,v 1.1.1.1 2012/03/23 21:20:06 christos Exp $ */
|
||||
/* $NetBSD: linux.h,v 1.1.1.2 2012/07/22 13:44:34 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
|
4
external/bsd/ipf/dist/ipsend/arp.c
vendored
4
external/bsd/ipf/dist/ipsend/arp.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: arp.c,v 1.1.1.1 2012/03/23 21:20:06 christos Exp $ */
|
||||
/* $NetBSD: arp.c,v 1.1.1.2 2012/07/22 13:44:35 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* arp.c (C) 1995-1998 Darren Reed
|
||||
@ -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";
|
||||
static const char rcsid[] = "@(#)$Id: arp.c,v 1.1.1.2 2012/07/22 13:44:35 darrenr Exp $";
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
4
external/bsd/ipf/dist/ipsend/ipresend.c
vendored
4
external/bsd/ipf/dist/ipsend/ipresend.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ipresend.c,v 1.1.1.1 2012/03/23 21:20:06 christos Exp $ */
|
||||
/* $NetBSD: ipresend.c,v 1.1.1.2 2012/07/22 13:44:36 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* ipresend.c (C) 1995-1998 Darren Reed
|
||||
@ -8,7 +8,7 @@
|
||||
*/
|
||||
#if !defined(lint)
|
||||
static const char sccsid[] = "%W% %G% (C)1995 Darren Reed";
|
||||
static const char rcsid[] = "@(#)Id";
|
||||
static const char rcsid[] = "@(#)$Id: ipresend.c,v 1.1.1.2 2012/07/22 13:44:36 darrenr Exp $";
|
||||
#endif
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
|
4
external/bsd/ipf/dist/ipsend/ipsend.c
vendored
4
external/bsd/ipf/dist/ipsend/ipsend.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ipsend.c,v 1.1.1.1 2012/03/23 21:20:06 christos Exp $ */
|
||||
/* $NetBSD: ipsend.c,v 1.1.1.2 2012/07/22 13:44:36 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* ipsend.c (C) 1995-1998 Darren Reed
|
||||
@ -7,7 +7,7 @@
|
||||
*/
|
||||
#if !defined(lint)
|
||||
static const char sccsid[] = "@(#)ipsend.c 1.5 12/10/95 (C)1995 Darren Reed";
|
||||
static const char rcsid[] = "@(#)Id";
|
||||
static const char rcsid[] = "@(#)$Id: ipsend.c,v 1.1.1.2 2012/07/22 13:44:36 darrenr Exp $";
|
||||
#endif
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
|
4
external/bsd/ipf/dist/ipsend/ipsend.h
vendored
4
external/bsd/ipf/dist/ipsend/ipsend.h
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ipsend.h,v 1.1.1.1 2012/03/23 21:20:07 christos Exp $ */
|
||||
/* $NetBSD: ipsend.h,v 1.1.1.2 2012/07/22 13:44:36 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* ipsend.h (C) 1997-1998 Darren Reed
|
||||
@ -29,7 +29,7 @@
|
||||
#ifdef linux
|
||||
#include <linux/sockios.h>
|
||||
#endif
|
||||
#include "tcpip.h"
|
||||
#include "netinet/tcpip.h"
|
||||
#include "ipt.h"
|
||||
|
||||
extern int resolve __P((char *, char *));
|
||||
|
6
external/bsd/ipf/dist/ipsend/ipsopt.c
vendored
6
external/bsd/ipf/dist/ipsend/ipsopt.c
vendored
@ -1,14 +1,14 @@
|
||||
/* $NetBSD: ipsopt.c,v 1.1.1.1 2012/03/23 21:20:07 christos Exp $ */
|
||||
/* $NetBSD: ipsopt.c,v 1.1.1.2 2012/07/22 13:44:36 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2007 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";
|
||||
static const char rcsid[] = "@(#)$Id: ipsopt.c,v 1.1.1.2 2012/07/22 13:44:36 darrenr Exp $";
|
||||
#endif
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
|
4
external/bsd/ipf/dist/ipsend/iptest.c
vendored
4
external/bsd/ipf/dist/ipsend/iptest.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: iptest.c,v 1.1.1.1 2012/03/23 21:20:07 christos Exp $ */
|
||||
/* $NetBSD: iptest.c,v 1.1.1.2 2012/07/22 13:44:37 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* ipsend.c (C) 1995-1998 Darren Reed
|
||||
@ -8,7 +8,7 @@
|
||||
*/
|
||||
#if !defined(lint)
|
||||
static const char sccsid[] = "%W% %G% (C)1995 Darren Reed";
|
||||
static const char rcsid[] = "@(#)Id";
|
||||
static const char rcsid[] = "@(#)$Id: iptest.c,v 1.1.1.2 2012/07/22 13:44:37 darrenr Exp $";
|
||||
#endif
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
|
4
external/bsd/ipf/dist/ipsend/larp.c
vendored
4
external/bsd/ipf/dist/ipsend/larp.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: larp.c,v 1.1.1.1 2012/03/23 21:20:06 christos Exp $ */
|
||||
/* $NetBSD: larp.c,v 1.1.1.2 2012/07/22 13:44:37 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* larp.c (C) 1995-1998 Darren Reed
|
||||
@ -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";
|
||||
static const char rcsid[] = "@(#)$Id: larp.c,v 1.1.1.2 2012/07/22 13:44:37 darrenr Exp $";
|
||||
#endif
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
|
4
external/bsd/ipf/dist/ipsend/linux.h
vendored
4
external/bsd/ipf/dist/ipsend/linux.h
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: linux.h,v 1.1.1.1 2012/03/23 21:20:07 christos Exp $ */
|
||||
/* $NetBSD: linux.h,v 1.1.1.2 2012/07/22 13:44:37 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1999 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
|
||||
|
4
external/bsd/ipf/dist/ipsend/lsock.c
vendored
4
external/bsd/ipf/dist/ipsend/lsock.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lsock.c,v 1.1.1.1 2012/03/23 21:20:06 christos Exp $ */
|
||||
/* $NetBSD: lsock.c,v 1.1.1.2 2012/07/22 13:44:37 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* lsock.c (C) 1995-1998 Darren Reed
|
||||
@ -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";
|
||||
static const char rcsid[] = "@(#)$Id: lsock.c,v 1.1.1.2 2012/07/22 13:44:37 darrenr Exp $";
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
4
external/bsd/ipf/dist/ipsend/resend.c
vendored
4
external/bsd/ipf/dist/ipsend/resend.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: resend.c,v 1.1.1.1 2012/03/23 21:20:07 christos Exp $ */
|
||||
/* $NetBSD: resend.c,v 1.1.1.2 2012/07/22 13:44:37 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* resend.c (C) 1995-1998 Darren Reed
|
||||
@ -8,7 +8,7 @@
|
||||
*/
|
||||
#if !defined(lint)
|
||||
static const char sccsid[] = "@(#)resend.c 1.3 1/11/96 (C)1995 Darren Reed";
|
||||
static const char rcsid[] = "@(#)Id";
|
||||
static const char rcsid[] = "@(#)$Id: resend.c,v 1.1.1.2 2012/07/22 13:44:37 darrenr Exp $";
|
||||
#endif
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
|
4
external/bsd/ipf/dist/ipsend/sdlpi.c
vendored
4
external/bsd/ipf/dist/ipsend/sdlpi.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sdlpi.c,v 1.1.1.1 2012/03/23 21:20:06 christos Exp $ */
|
||||
/* $NetBSD: sdlpi.c,v 1.1.1.2 2012/07/22 13:44:37 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* (C)opyright 1992-1998 Darren Reed. (from tcplog)
|
||||
@ -48,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";
|
||||
static const char rcsid[] = "@(#)$Id: sdlpi.c,v 1.1.1.2 2012/07/22 13:44:37 darrenr Exp $";
|
||||
#endif
|
||||
|
||||
#define CHUNKSIZE 8192
|
||||
|
4
external/bsd/ipf/dist/ipsend/slinux.c
vendored
4
external/bsd/ipf/dist/ipsend/slinux.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: slinux.c,v 1.1.1.1 2012/03/23 21:20:07 christos Exp $ */
|
||||
/* $NetBSD: slinux.c,v 1.1.1.2 2012/07/22 13:44:37 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* (C)opyright 1992-1998 Darren Reed. (from tcplog)
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
#if !defined(lint)
|
||||
static const char sccsid[] = "@(#)slinux.c 1.2 8/25/95";
|
||||
static const char rcsid[] = "@(#)Id";
|
||||
static const char rcsid[] = "@(#)$Id: slinux.c,v 1.1.1.2 2012/07/22 13:44:37 darrenr Exp $";
|
||||
#endif
|
||||
|
||||
#define CHUNKSIZE 8192
|
||||
|
4
external/bsd/ipf/dist/ipsend/snit.c
vendored
4
external/bsd/ipf/dist/ipsend/snit.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: snit.c,v 1.1.1.1 2012/03/23 21:20:07 christos Exp $ */
|
||||
/* $NetBSD: snit.c,v 1.1.1.2 2012/07/22 13:44:37 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* (C)opyright 1992-1998 Darren Reed. (from tcplog)
|
||||
@ -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";
|
||||
static const char rcsid[] = "@(#)$Id: snit.c,v 1.1.1.2 2012/07/22 13:44:37 darrenr Exp $";
|
||||
#endif
|
||||
|
||||
#define CHUNKSIZE 8192
|
||||
|
6
external/bsd/ipf/dist/ipt.h
vendored
6
external/bsd/ipf/dist/ipt.h
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: ipt.h,v 1.1.1.1 2012/03/23 21:20:00 christos Exp $ */
|
||||
/* $NetBSD: ipt.h,v 1.1.1.2 2012/07/22 13:44:25 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2007 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: ipt.h,v 1.1.1.2 2012/07/22 13:44:25 darrenr Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IPT_H__
|
||||
|
6
external/bsd/ipf/dist/kmem.h
vendored
6
external/bsd/ipf/dist/kmem.h
vendored
@ -1,10 +1,10 @@
|
||||
/* $NetBSD: kmem.h,v 1.1.1.1 2012/03/23 21:20:00 christos Exp $ */
|
||||
/* $NetBSD: kmem.h,v 1.1.1.2 2012/07/22 13:44:25 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
* Id
|
||||
* $Id: kmem.h,v 1.1.1.2 2012/07/22 13:44:25 darrenr Exp $
|
||||
*/
|
||||
|
||||
#ifndef __KMEM_H__
|
||||
|
4
external/bsd/ipf/dist/l4check/l4check.c
vendored
4
external/bsd/ipf/dist/l4check/l4check.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: l4check.c,v 1.1.1.1 2012/03/23 21:20:07 christos Exp $ */
|
||||
/* $NetBSD: l4check.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* (C)Copyright (C) 2007 by Darren Reed.
|
||||
* (C)Copyright (C) 2012 by Darren Reed.
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
6
external/bsd/ipf/dist/lib/addicmp.c
vendored
6
external/bsd/ipf/dist/lib/addicmp.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: addicmp.c,v 1.1.1.1 2012/03/23 21:20:07 christos Exp $ */
|
||||
/* $NetBSD: addicmp.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: addicmp.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
|
6
external/bsd/ipf/dist/lib/addipopt.c
vendored
6
external/bsd/ipf/dist/lib/addipopt.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: addipopt.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: addipopt.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: addipopt.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
6
external/bsd/ipf/dist/lib/alist_free.c
vendored
6
external/bsd/ipf/dist/lib/alist_free.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: alist_free.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: alist_free.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id: alist_free.c,v 1.3.2.1 2012/01/26 05:44:26 darren_r Exp
|
||||
* $Id: alist_free.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
#include "ipf.h"
|
||||
|
||||
|
6
external/bsd/ipf/dist/lib/alist_new.c
vendored
6
external/bsd/ipf/dist/lib/alist_new.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: alist_new.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: alist_new.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id: alist_new.c,v 1.5.2.1 2012/01/26 05:44:26 darren_r Exp
|
||||
* $Id: alist_new.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
6
external/bsd/ipf/dist/lib/allocmbt.c
vendored
6
external/bsd/ipf/dist/lib/allocmbt.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: allocmbt.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: allocmbt.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id: allocmbt.c,v 1.1 2007/08/20 10:15:23 darren_r Exp
|
||||
* $Id: allocmbt.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
6
external/bsd/ipf/dist/lib/assigndefined.c
vendored
6
external/bsd/ipf/dist/lib/assigndefined.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: assigndefined.c,v 1.1.1.1 2012/03/23 21:20:07 christos Exp $ */
|
||||
/* $NetBSD: assigndefined.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id: assigndefined.c,v 1.4.2.1 2012/01/26 05:44:26 darren_r Exp
|
||||
* $Id: assigndefined.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
6
external/bsd/ipf/dist/lib/bcopywrap.c
vendored
6
external/bsd/ipf/dist/lib/bcopywrap.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: bcopywrap.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: bcopywrap.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: bcopywrap.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
6
external/bsd/ipf/dist/lib/binprint.c
vendored
6
external/bsd/ipf/dist/lib/binprint.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: binprint.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: binprint.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: binprint.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
6
external/bsd/ipf/dist/lib/buildopts.c
vendored
6
external/bsd/ipf/dist/lib/buildopts.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: buildopts.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: buildopts.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: buildopts.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
8
external/bsd/ipf/dist/lib/checkrev.c
vendored
8
external/bsd/ipf/dist/lib/checkrev.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: checkrev.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: checkrev.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: checkrev.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
@ -33,7 +33,7 @@ int checkrev(ipfname)
|
||||
}
|
||||
|
||||
if (ioctl(vfd, SIOCGETFS, &obj)) {
|
||||
perror("ioctl(SIOCGETFS)");
|
||||
ipferror(vfd, "ioctl(SIOCGETFS)");
|
||||
close(vfd);
|
||||
vfd = -1;
|
||||
return -1;
|
||||
|
6
external/bsd/ipf/dist/lib/connecttcp.c
vendored
6
external/bsd/ipf/dist/lib/connecttcp.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: connecttcp.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: connecttcp.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id: connecttcp.c,v 1.3.2.1 2012/01/26 05:44:26 darren_r Exp
|
||||
* $Id: connecttcp.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
6
external/bsd/ipf/dist/lib/count4bits.c
vendored
6
external/bsd/ipf/dist/lib/count4bits.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: count4bits.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: count4bits.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: count4bits.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
6
external/bsd/ipf/dist/lib/count6bits.c
vendored
6
external/bsd/ipf/dist/lib/count6bits.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: count6bits.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: count6bits.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: count6bits.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
6
external/bsd/ipf/dist/lib/debug.c
vendored
6
external/bsd/ipf/dist/lib/debug.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: debug.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: debug.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: debug.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#if defined(__STDC__)
|
||||
|
6
external/bsd/ipf/dist/lib/dupmbt.c
vendored
6
external/bsd/ipf/dist/lib/dupmbt.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: dupmbt.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: dupmbt.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id: dupmbt.c,v 1.3.2.1 2012/01/26 05:44:26 darren_r Exp
|
||||
* $Id: dupmbt.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
8
external/bsd/ipf/dist/lib/facpri.c
vendored
8
external/bsd/ipf/dist/lib/facpri.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: facpri.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: facpri.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: facpri.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -22,7 +22,7 @@
|
||||
#include "facpri.h"
|
||||
|
||||
#if !defined(lint)
|
||||
static const char rcsid[] = "@(#)Id";
|
||||
static const char rcsid[] = "@(#)$Id: facpri.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $";
|
||||
#endif
|
||||
|
||||
|
||||
|
6
external/bsd/ipf/dist/lib/facpri.h
vendored
6
external/bsd/ipf/dist/lib/facpri.h
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: facpri.h,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: facpri.h,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: facpri.h,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#ifndef __FACPRI_H__
|
||||
|
6
external/bsd/ipf/dist/lib/fill6bits.c
vendored
6
external/bsd/ipf/dist/lib/fill6bits.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: fill6bits.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: fill6bits.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: fill6bits.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
6
external/bsd/ipf/dist/lib/findword.c
vendored
6
external/bsd/ipf/dist/lib/findword.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: findword.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: findword.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2007 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id: findword.c,v 1.3 2007/10/25 12:55:32 marttikuparinen Exp
|
||||
* $Id: findword.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
6
external/bsd/ipf/dist/lib/flags.c
vendored
6
external/bsd/ipf/dist/lib/flags.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: flags.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: flags.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: flags.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
6
external/bsd/ipf/dist/lib/freembt.c
vendored
6
external/bsd/ipf/dist/lib/freembt.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: freembt.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: freembt.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id: freembt.c,v 1.3.2.1 2012/01/26 05:44:26 darren_r Exp
|
||||
* $Id: freembt.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
6
external/bsd/ipf/dist/lib/genmask.c
vendored
6
external/bsd/ipf/dist/lib/genmask.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: genmask.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: genmask.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: genmask.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
6
external/bsd/ipf/dist/lib/gethost.c
vendored
6
external/bsd/ipf/dist/lib/gethost.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: gethost.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: gethost.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: gethost.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
6
external/bsd/ipf/dist/lib/geticmptype.c
vendored
6
external/bsd/ipf/dist/lib/geticmptype.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: geticmptype.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: geticmptype.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: geticmptype.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
#include "ipf.h"
|
||||
|
||||
|
7
external/bsd/ipf/dist/lib/getifname.c
vendored
7
external/bsd/ipf/dist/lib/getifname.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: getifname.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: getifname.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: getifname.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
@ -87,6 +87,7 @@ char *getifname(ptr)
|
||||
char *getifname(ptr)
|
||||
struct ifnet *ptr;
|
||||
{
|
||||
ptr = ptr;
|
||||
return "X";
|
||||
}
|
||||
#endif
|
||||
|
6
external/bsd/ipf/dist/lib/getnattype.c
vendored
6
external/bsd/ipf/dist/lib/getnattype.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: getnattype.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: getnattype.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
@ -11,7 +11,7 @@
|
||||
#include "kmem.h"
|
||||
|
||||
#if !defined(lint)
|
||||
static const char rcsid[] = "@(#)Id";
|
||||
static const char rcsid[] = "@(#)$Id: getnattype.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $";
|
||||
#endif
|
||||
|
||||
|
||||
|
6
external/bsd/ipf/dist/lib/getport.c
vendored
6
external/bsd/ipf/dist/lib/getport.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: getport.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: getport.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: getport.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
6
external/bsd/ipf/dist/lib/getportproto.c
vendored
6
external/bsd/ipf/dist/lib/getportproto.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: getportproto.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: getportproto.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: getportproto.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
|
6
external/bsd/ipf/dist/lib/getproto.c
vendored
6
external/bsd/ipf/dist/lib/getproto.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: getproto.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: getproto.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: getproto.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
6
external/bsd/ipf/dist/lib/getsumd.c
vendored
6
external/bsd/ipf/dist/lib/getsumd.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: getsumd.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: getsumd.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: getsumd.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
6
external/bsd/ipf/dist/lib/hostname.c
vendored
6
external/bsd/ipf/dist/lib/hostname.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: hostname.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: hostname.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: hostname.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
6
external/bsd/ipf/dist/lib/icmpcode.c
vendored
6
external/bsd/ipf/dist/lib/icmpcode.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: icmpcode.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: icmpcode.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: icmpcode.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
|
6
external/bsd/ipf/dist/lib/icmptypename.c
vendored
6
external/bsd/ipf/dist/lib/icmptypename.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: icmptypename.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: icmptypename.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: icmptypename.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
#include "ipf.h"
|
||||
|
||||
|
6
external/bsd/ipf/dist/lib/icmptypes.c
vendored
6
external/bsd/ipf/dist/lib/icmptypes.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: icmptypes.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: icmptypes.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: icmptypes.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
#include "ipf.h"
|
||||
|
||||
|
6
external/bsd/ipf/dist/lib/initparse.c
vendored
6
external/bsd/ipf/dist/lib/initparse.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: initparse.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: initparse.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: initparse.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $
|
||||
*/
|
||||
#include "ipf.h"
|
||||
|
||||
|
29
external/bsd/ipf/dist/lib/interror.c
vendored
29
external/bsd/ipf/dist/lib/interror.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: interror.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: interror.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id: interror.c,v 1.9.2.6 2012/01/29 05:30:36 darren_r Exp
|
||||
* $Id: interror.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
@ -19,7 +19,7 @@ typedef struct {
|
||||
|
||||
static ipf_error_entry_t *find_error __P((int));
|
||||
|
||||
#define IPF_NUM_ERRORS 460
|
||||
#define IPF_NUM_ERRORS 475
|
||||
|
||||
/*
|
||||
* NO REUSE OF NUMBERS!
|
||||
@ -117,7 +117,7 @@ static ipf_error_entry_t ipf_errors[IPF_NUM_ERRORS] = {
|
||||
{ 87, "value for iri_nrules is 0" },
|
||||
{ 88, "NULL pointer specified for where to copy rule to" },
|
||||
{ 89, "copyout of rule failed" },
|
||||
{ 90, "copyout of rule data section failed" },
|
||||
{ 90, "" },
|
||||
{ 91, "could not get token for rule iteration" },
|
||||
{ 92, "unrecognised generic iterator" },
|
||||
{ 93, "could not find token for generic iterator" },
|
||||
@ -227,6 +227,9 @@ static ipf_error_entry_t ipf_errors[IPF_NUM_ERRORS] = {
|
||||
{ 30021, "node already exists in the table" },
|
||||
{ 30022, "could not find node to delete in table" },
|
||||
{ 30023, "uid mismatch on node to delete" },
|
||||
{ 30024, "object size incorrect for hash table" },
|
||||
{ 30025, "hash table size must be at least 1"},
|
||||
{ 30026, "cannot allocate memory for hash table context" },
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{ 40001, "invalid minor device numebr for log read" },
|
||||
{ 40002, "read size too small" },
|
||||
@ -299,7 +302,7 @@ log" },
|
||||
{ 60018, "NAT not locked for fetching NAT table entry" },
|
||||
{ 60019, "error copying in NAT token data for deletion" },
|
||||
{ 60020, "unknown NAT ioctl" },
|
||||
{ 60021, "cannot add encapsulation rule for TCP/UDP" },
|
||||
{ 60021, "" },
|
||||
{ 60022, "resolving proxy name in NAT rule failed" },
|
||||
{ 60023, "only reply age specified in NAT rule" },
|
||||
{ 60024, "error doing copyin to determine NAT entry size" },
|
||||
@ -370,7 +373,7 @@ log" },
|
||||
{ 70013, "error copying out pool node" },
|
||||
{ 70014, "add node size incorrect" },
|
||||
{ 70015, "error copying in pool node" },
|
||||
{ 70016, "node address/mask family mismatch" },
|
||||
{ 70016, "" },
|
||||
{ 70017, "cannot find pool for node" },
|
||||
{ 70018, "node entry already present in pool" },
|
||||
{ 70019, "delete node size incorrect" },
|
||||
@ -381,6 +384,17 @@ log" },
|
||||
{ 70024, "uid mismatch for node removal" },
|
||||
{ 70025, "stats device unit is invalid" },
|
||||
{ 70026, "error copying out statistics" },
|
||||
{ 70027, "could not remove node from radix tree" },
|
||||
{ 70028, "incorrect address length in pool node add" },
|
||||
{ 70029, "incorrect mask length in pool node add" },
|
||||
{ 70030, "incorrect address length in pool node remove" },
|
||||
{ 70031, "incorrect mask length in pool node remove" },
|
||||
{ 70032, "cannot allocate memory for pool context" },
|
||||
{ 70033, "cannot allocate memory for radix tree context" },
|
||||
{ 70034, "adding IPv6 node with incorrect address length" },
|
||||
{ 70035, "IPv4 address not masked" },
|
||||
{ 70036, "IPv6 address not masked" },
|
||||
{ 70037, "removing IPv6 node with incorrect address length" },
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{ 80001, "could not find proxy" },
|
||||
{ 80002, "proxy does not support control operations" },
|
||||
@ -485,6 +499,7 @@ log" },
|
||||
{ 120025, "error copying out dest. list statistics" },
|
||||
{ 120026, "cannot allocate memory for destination node" },
|
||||
{ 120027, "error copying in destination node" },
|
||||
{ 120028, "cannot allocate memory for destination context " },
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{ 130001, "ioctl denied by system security level" },
|
||||
{ 130002, "ioctl operation on invalid minor device" },
|
||||
|
6
external/bsd/ipf/dist/lib/ionames.c
vendored
6
external/bsd/ipf/dist/lib/ionames.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: ionames.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: ionames.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: ionames.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $
|
||||
*/
|
||||
#include "ipf.h"
|
||||
|
||||
|
14
external/bsd/ipf/dist/lib/ipf_dotuning.c
vendored
14
external/bsd/ipf/dist/lib/ipf_dotuning.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: ipf_dotuning.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: ipf_dotuning.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: ipf_dotuning.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
@ -31,7 +31,8 @@ void ipf_dotuning(fd, tuneargs, iocfn)
|
||||
if (!strcmp(s, "list")) {
|
||||
while (1) {
|
||||
if ((*iocfn)(fd, SIOCIPFGETNEXT, &obj) == -1) {
|
||||
perror("ioctl(SIOCIPFGETNEXT)");
|
||||
ipf_perror_fd(fd, iocfn,
|
||||
"ioctl(SIOCIPFGETNEXT)");
|
||||
break;
|
||||
}
|
||||
if (tu.ipft_cookie == NULL)
|
||||
@ -46,7 +47,8 @@ void ipf_dotuning(fd, tuneargs, iocfn)
|
||||
strncpy(tu.ipft_name, s, sizeof(tu.ipft_name));
|
||||
if (sscanf(t, "%lu", &tu.ipft_vlong) == 1) {
|
||||
if ((*iocfn)(fd, SIOCIPFSET, &obj) == -1) {
|
||||
perror("ioctl(SIOCIPFSET)");
|
||||
ipf_perror_fd(fd, iocfn,
|
||||
"ioctl(SIOCIPFSET)");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@ -57,7 +59,7 @@ void ipf_dotuning(fd, tuneargs, iocfn)
|
||||
tu.ipft_cookie = NULL;
|
||||
strncpy(tu.ipft_name, s, sizeof(tu.ipft_name));
|
||||
if ((*iocfn)(fd, SIOCIPFGET, &obj) == -1) {
|
||||
perror("ioctl(SIOCIPFGET)");
|
||||
ipf_perror_fd(fd, iocfn, "ioctl(SIOCIPFGET)");
|
||||
return;
|
||||
}
|
||||
if (tu.ipft_cookie == NULL) {
|
||||
|
37
external/bsd/ipf/dist/lib/ipf_perror.c
vendored
37
external/bsd/ipf/dist/lib/ipf_perror.c
vendored
@ -1,5 +1,7 @@
|
||||
/* $NetBSD: ipf_perror.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: ipf_perror.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $ */
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include "ipf.h"
|
||||
|
||||
void
|
||||
@ -12,3 +14,36 @@ ipf_perror(err, string)
|
||||
else
|
||||
fprintf(stderr, "%s %s\n", string, ipf_strerror(err));
|
||||
}
|
||||
|
||||
int
|
||||
ipf_perror_fd(fd, iocfunc, string)
|
||||
int fd;
|
||||
ioctlfunc_t iocfunc;
|
||||
char *string;
|
||||
{
|
||||
int save;
|
||||
int realerr;
|
||||
|
||||
save = errno;
|
||||
if ((*iocfunc)(fd, SIOCIPFINTERROR, &realerr) == -1)
|
||||
realerr = 0;
|
||||
|
||||
errno = save;
|
||||
fprintf(stderr, "%d:", realerr);
|
||||
ipf_perror(realerr, string);
|
||||
return realerr ? realerr : save;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
ipferror(fd, msg)
|
||||
int fd;
|
||||
char *msg;
|
||||
{
|
||||
if (fd >= 0) {
|
||||
ipf_perror_fd(fd, ioctl, msg);
|
||||
} else {
|
||||
fprintf(stderr, "0:");
|
||||
perror(msg);
|
||||
}
|
||||
}
|
||||
|
11
external/bsd/ipf/dist/lib/ipft_hx.c
vendored
11
external/bsd/ipf/dist/lib/ipft_hx.c
vendored
@ -1,13 +1,13 @@
|
||||
/* $NetBSD: ipft_hx.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: ipft_hx.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011 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[] = "@(#)ipft_hx.c 1.1 3/9/96 (C) 1996 Darren Reed";
|
||||
static const char rcsid[] = "@(#)Id";
|
||||
static const char rcsid[] = "@(#)$Id: ipft_hx.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $";
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
@ -134,11 +134,12 @@ static int hex_readip(mb, ifn, dir)
|
||||
ip = (ip_t *)readhex(s, (char *)ip);
|
||||
if ((opts & OPT_DEBUG) != 0) {
|
||||
if (opts & OPT_ASCII) {
|
||||
int c = *t;
|
||||
if (t < (char *)ip)
|
||||
putchar('\t');
|
||||
while (t < (char *)ip) {
|
||||
if (ISPRINT(*t) && ISASCII(*t))
|
||||
putchar(*t);
|
||||
if (isprint(c) && isascii(c))
|
||||
putchar(c);
|
||||
else
|
||||
putchar('.');
|
||||
t++;
|
||||
|
10
external/bsd/ipf/dist/lib/ipft_pc.c
vendored
10
external/bsd/ipf/dist/lib/ipft_pc.c
vendored
@ -1,17 +1,17 @@
|
||||
/* $NetBSD: ipft_pc.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: ipft_pc.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: ipft_pc.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $
|
||||
*/
|
||||
#include "ipf.h"
|
||||
#include "ipt.h"
|
||||
|
||||
#if !defined(lint)
|
||||
static const char rcsid[] = "@(#)Id";
|
||||
static const char rcsid[] = "@(#)$Id: ipft_pc.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $";
|
||||
#endif
|
||||
|
||||
struct llc {
|
||||
@ -215,6 +215,8 @@ static int ipcap_readip(mb, ifn, dir)
|
||||
char *buf;
|
||||
int cnt;
|
||||
|
||||
ifn = ifn; /* gcc -Wextra */
|
||||
dir = dir; /* gcc -Wextra */
|
||||
buf = (char *)mb->mb_buf;
|
||||
cnt = sizeof(mb->mb_buf);
|
||||
l = llcp;
|
||||
|
45
external/bsd/ipf/dist/lib/ipft_tx.c
vendored
45
external/bsd/ipf/dist/lib/ipft_tx.c
vendored
@ -1,15 +1,15 @@
|
||||
/* $NetBSD: ipft_tx.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: ipft_tx.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: ipft_tx.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $
|
||||
*/
|
||||
#if !defined(lint)
|
||||
static const char sccsid[] = "@(#)ipft_tx.c 1.7 6/5/96 (C) 1993 Darren Reed";
|
||||
static const char rcsid[] = "@(#)Id";
|
||||
static const char rcsid[] = "@(#)$Id: ipft_tx.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $";
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
@ -84,13 +84,6 @@ static u_short tx_portnum(name)
|
||||
}
|
||||
|
||||
|
||||
char *tx_icmptypes[] = {
|
||||
"echorep", (char *)NULL, (char *)NULL, "unreach", "squench",
|
||||
"redir", (char *)NULL, (char *)NULL, "echo", "routerad",
|
||||
"routersol", "timex", "paramprob", "timest", "timestrep",
|
||||
"inforeq", "inforep", "maskreq", "maskrep", "END"
|
||||
};
|
||||
|
||||
static int text_open(fname)
|
||||
char *fname;
|
||||
{
|
||||
@ -305,24 +298,20 @@ static int parseline(line, ip, ifn, out)
|
||||
cpp++;
|
||||
}
|
||||
} else if (*cpp && ip->ip_p == IPPROTO_ICMP) {
|
||||
extern char *tx_icmptypes[];
|
||||
char **s, *t;
|
||||
int i;
|
||||
char *t;
|
||||
|
||||
t = strchr(*cpp, ',');
|
||||
if (t != NULL)
|
||||
*t = '\0';
|
||||
|
||||
for (s = tx_icmptypes, i = 0; !*s || strcmp(*s, "END");
|
||||
s++, i++) {
|
||||
if (*s && !strcasecmp(*cpp, *s)) {
|
||||
ic->icmp_type = i;
|
||||
if (t != NULL)
|
||||
ic->icmp_code = atoi(t + 1);
|
||||
cpp++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ic->icmp_type = geticmptype(AF_INET, *cpp);
|
||||
if (t != NULL)
|
||||
ic->icmp_code = atoi(t + 1);
|
||||
cpp++;
|
||||
|
||||
if (ic->icmp_type == ICMP_ECHO ||
|
||||
ic->icmp_type == ICMP_ECHOREPLY)
|
||||
ic->icmp_id = htons(getpid());
|
||||
if (t != NULL)
|
||||
*t = ',';
|
||||
}
|
||||
@ -489,7 +478,13 @@ int parseipv6(cpp, ip6, ifn, out)
|
||||
if (t != NULL)
|
||||
*t = '\0';
|
||||
|
||||
ic6->icmp6_type = geticmptype(6, *cpp);
|
||||
ic6->icmp6_type = geticmptype(AF_INET6, *cpp);
|
||||
if (t != NULL)
|
||||
ic6->icmp6_code = atoi(t + 1);
|
||||
|
||||
if (ic6->icmp6_type == ICMP6_ECHO_REQUEST ||
|
||||
ic6->icmp6_type == ICMP6_ECHO_REPLY)
|
||||
ic6->icmp6_id = htons(getpid());
|
||||
|
||||
if (t != NULL)
|
||||
*t = ',';
|
||||
|
6
external/bsd/ipf/dist/lib/ipoptsec.c
vendored
6
external/bsd/ipf/dist/lib/ipoptsec.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: ipoptsec.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: ipoptsec.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: ipoptsec.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
6
external/bsd/ipf/dist/lib/kmem.c
vendored
6
external/bsd/ipf/dist/lib/kmem.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: kmem.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: kmem.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*/
|
||||
@ -44,7 +44,7 @@
|
||||
|
||||
#if !defined(lint)
|
||||
static const char sccsid[] = "@(#)kmem.c 1.4 1/12/96 (C) 1992 Darren Reed";
|
||||
static const char rcsid[] = "@(#)Id";
|
||||
static const char rcsid[] = "@(#)$Id: kmem.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $";
|
||||
#endif
|
||||
|
||||
|
||||
|
6
external/bsd/ipf/dist/lib/kmem.h
vendored
6
external/bsd/ipf/dist/lib/kmem.h
vendored
@ -1,10 +1,10 @@
|
||||
/* $NetBSD: kmem.h,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: kmem.h,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
* Id
|
||||
* $Id: kmem.h,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $
|
||||
*/
|
||||
|
||||
#ifndef __KMEM_H__
|
||||
|
6
external/bsd/ipf/dist/lib/kmemcpywrap.c
vendored
6
external/bsd/ipf/dist/lib/kmemcpywrap.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: kmemcpywrap.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: kmemcpywrap.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: kmemcpywrap.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
6
external/bsd/ipf/dist/lib/kvatoname.c
vendored
6
external/bsd/ipf/dist/lib/kvatoname.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: kvatoname.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: kvatoname.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: kvatoname.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
16
external/bsd/ipf/dist/lib/load_dstlist.c
vendored
16
external/bsd/ipf/dist/lib/load_dstlist.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: load_dstlist.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: load_dstlist.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id: load_dstlist.c,v 1.1.2.2 2012/01/26 05:44:26 darren_r Exp
|
||||
* $Id: load_dstlist.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
@ -46,8 +46,8 @@ load_dstlist(dst, iocfunc, nodes)
|
||||
if ((opts & OPT_REMOVE) == 0) {
|
||||
if (pool_ioctl(iocfunc, SIOCLOOKUPADDTABLE, &op))
|
||||
if ((opts & OPT_DONOTHING) == 0) {
|
||||
perror("load_dstlist:SIOCLOOKUPADDTABLE");
|
||||
return -1;
|
||||
return ipf_perror_fd(pool_fd(), iocfunc,
|
||||
"add destination list table");
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,13 +58,13 @@ load_dstlist(dst, iocfunc, nodes)
|
||||
}
|
||||
|
||||
for (a = nodes; a != NULL; a = a->ipfd_next)
|
||||
load_dstlistnode(dst->ipld_unit, dest.ipld_name, a, 0, iocfunc);
|
||||
load_dstlistnode(dst->ipld_unit, dest.ipld_name, a, iocfunc);
|
||||
|
||||
if ((opts & OPT_REMOVE) != 0) {
|
||||
if (pool_ioctl(iocfunc, SIOCLOOKUPDELTABLE, &op))
|
||||
if ((opts & OPT_DONOTHING) == 0) {
|
||||
perror("load_dstlist:SIOCLOOKUPDELTABLE");
|
||||
return -1;
|
||||
return ipf_perror_fd(pool_fd(), iocfunc,
|
||||
"delete destination list table");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
43
external/bsd/ipf/dist/lib/load_dstlistnode.c
vendored
43
external/bsd/ipf/dist/lib/load_dstlistnode.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: load_dstlistnode.c,v 1.1.1.1 2012/03/23 21:20:07 christos Exp $ */
|
||||
/* $NetBSD: load_dstlistnode.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id: load_dstlistnode.c,v 1.1.2.1 2012/01/26 05:44:26 darren_r Exp
|
||||
* $Id: load_dstlistnode.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
@ -16,15 +16,15 @@
|
||||
|
||||
|
||||
int
|
||||
load_dstlistnode(role, name, node, ttl, iocfunc)
|
||||
load_dstlistnode(role, name, node, iocfunc)
|
||||
int role;
|
||||
char *name;
|
||||
ipf_dstnode_t *node;
|
||||
int ttl;
|
||||
ioctlfunc_t iocfunc;
|
||||
{
|
||||
iplookupop_t op;
|
||||
frdest_t *dst;
|
||||
char *what;
|
||||
int err;
|
||||
|
||||
if (pool_open() == -1)
|
||||
@ -38,28 +38,35 @@ load_dstlistnode(role, name, node, ttl, iocfunc)
|
||||
op.iplo_type = IPLT_DSTLIST;
|
||||
op.iplo_arg = 0;
|
||||
op.iplo_struct = dst;
|
||||
op.iplo_size = sizeof(*dst) + node->ipfd_dest.fd_name;
|
||||
strncpy(op.iplo_name, name, sizeof(op.iplo_name));
|
||||
op.iplo_size = sizeof(*dst);
|
||||
if (node->ipfd_dest.fd_name >= 0)
|
||||
op.iplo_size += node->ipfd_dest.fd_name;
|
||||
(void) strncpy(op.iplo_name, name, sizeof(op.iplo_name));
|
||||
|
||||
dst->fd_addr = node->ipfd_dest.fd_addr;
|
||||
dst->fd_type = node->ipfd_dest.fd_type;
|
||||
dst->fd_name = node->ipfd_dest.fd_name;
|
||||
bcopy(node->ipfd_names, (char *)dst + sizeof(*dst),
|
||||
node->ipfd_dest.fd_name);
|
||||
if (node->ipfd_dest.fd_name >= 0)
|
||||
bcopy(node->ipfd_names, (char *)dst + sizeof(*dst),
|
||||
node->ipfd_dest.fd_name);
|
||||
|
||||
if ((opts & OPT_REMOVE) == 0)
|
||||
if ((opts & OPT_REMOVE) == 0) {
|
||||
what = "add";
|
||||
err = pool_ioctl(iocfunc, SIOCLOOKUPADDNODE, &op);
|
||||
else
|
||||
} else {
|
||||
what = "delete";
|
||||
err = pool_ioctl(iocfunc, SIOCLOOKUPDELNODE, &op);
|
||||
|
||||
if (err != 0) {
|
||||
if ((opts & OPT_DONOTHING) == 0) {
|
||||
perror("load_dstlistnode:SIOCLOOKUP*NODE");
|
||||
free(dst);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
free(dst);
|
||||
|
||||
if (err != 0) {
|
||||
if ((opts & OPT_DONOTHING) == 0) {
|
||||
char msg[80];
|
||||
|
||||
(void) sprintf(msg, "%s lookup node", what);
|
||||
return ipf_perror_fd(pool_fd(), iocfunc, msg);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
6
external/bsd/ipf/dist/lib/load_file.c
vendored
6
external/bsd/ipf/dist/lib/load_file.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: load_file.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: load_file.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id: load_file.c,v 1.6.2.1 2012/01/26 05:44:26 darren_r Exp
|
||||
* $Id: load_file.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include "ipf.h"
|
||||
|
22
external/bsd/ipf/dist/lib/load_hash.c
vendored
22
external/bsd/ipf/dist/lib/load_hash.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: load_hash.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: load_hash.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: load_hash.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
@ -42,10 +42,7 @@ load_hash(iphp, list, iocfunc)
|
||||
op.iplo_arg = IPHASH_ANON;
|
||||
op.iplo_size = sizeof(iph);
|
||||
op.iplo_struct = &iph;
|
||||
iph.iph_unit = iphp->iph_unit;
|
||||
iph.iph_type = iphp->iph_type;
|
||||
strncpy(iph.iph_name, iphp->iph_name, sizeof(iph.iph_name));
|
||||
iph.iph_flags = iphp->iph_flags;
|
||||
iph = *iphp;
|
||||
if (n <= 0)
|
||||
n = 1;
|
||||
if (iphp->iph_size == 0)
|
||||
@ -58,7 +55,6 @@ load_hash(iphp, list, iocfunc)
|
||||
iphp->iph_name, "size to match expected use");
|
||||
}
|
||||
iph.iph_size = size;
|
||||
iph.iph_seed = iphp->iph_seed;
|
||||
iph.iph_table = NULL;
|
||||
iph.iph_list = NULL;
|
||||
iph.iph_ref = 0;
|
||||
@ -66,8 +62,8 @@ load_hash(iphp, list, iocfunc)
|
||||
if ((opts & OPT_REMOVE) == 0) {
|
||||
if (pool_ioctl(iocfunc, SIOCLOOKUPADDTABLE, &op))
|
||||
if ((opts & OPT_DONOTHING) == 0) {
|
||||
perror("load_hash:SIOCLOOKUPADDTABLE");
|
||||
return -1;
|
||||
return ipf_perror_fd(pool_fd(), iocfunc,
|
||||
"add lookup hash table");
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,10 +71,6 @@ load_hash(iphp, list, iocfunc)
|
||||
strncpy(iphp->iph_name, op.iplo_name, sizeof(op.iplo_name));
|
||||
|
||||
if (opts & OPT_VERBOSE) {
|
||||
for (a = list; a != NULL; a = a->ipe_next) {
|
||||
a->ipe_addr.in4_addr = ntohl(a->ipe_addr.in4_addr);
|
||||
a->ipe_mask.in4_addr = ntohl(a->ipe_mask.in4_addr);
|
||||
}
|
||||
iph.iph_table = calloc(size, sizeof(*iph.iph_table));
|
||||
if (iph.iph_table == NULL) {
|
||||
perror("calloc(size, sizeof(*iph.iph_table))");
|
||||
@ -103,8 +95,8 @@ load_hash(iphp, list, iocfunc)
|
||||
if ((opts & OPT_REMOVE) != 0) {
|
||||
if (pool_ioctl(iocfunc, SIOCLOOKUPDELTABLE, &op))
|
||||
if ((opts & OPT_DONOTHING) == 0) {
|
||||
perror("load_hash:SIOCLOOKUPDELTABLE");
|
||||
return -1;
|
||||
return ipf_perror_fd(pool_fd(), iocfunc,
|
||||
"delete lookup hash table");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
20
external/bsd/ipf/dist/lib/load_hashnode.c
vendored
20
external/bsd/ipf/dist/lib/load_hashnode.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: load_hashnode.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: load_hashnode.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: load_hashnode.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
@ -25,6 +25,7 @@ load_hashnode(unit, name, node, ttl, iocfunc)
|
||||
{
|
||||
iplookupop_t op;
|
||||
iphtent_t ipe;
|
||||
char *what;
|
||||
int err;
|
||||
|
||||
if (pool_open() == -1)
|
||||
@ -47,15 +48,20 @@ load_hashnode(unit, name, node, ttl, iocfunc)
|
||||
bcopy((char *)&node->ipe_group, (char *)&ipe.ipe_group,
|
||||
sizeof(ipe.ipe_group));
|
||||
|
||||
if ((opts & OPT_REMOVE) == 0)
|
||||
if ((opts & OPT_REMOVE) == 0) {
|
||||
what = "add";
|
||||
err = pool_ioctl(iocfunc, SIOCLOOKUPADDNODE, &op);
|
||||
else
|
||||
} else {
|
||||
what = "delete";
|
||||
err = pool_ioctl(iocfunc, SIOCLOOKUPDELNODE, &op);
|
||||
}
|
||||
|
||||
if (err != 0)
|
||||
if (!(opts & OPT_DONOTHING)) {
|
||||
perror("load_hash:SIOCLOOKUP*NODE");
|
||||
return -1;
|
||||
char msg[80];
|
||||
|
||||
sprintf(msg, "%s node from lookup hash table", what);
|
||||
return ipf_perror_fd(pool_fd(), iocfunc, msg);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
18
external/bsd/ipf/dist/lib/load_pool.c
vendored
18
external/bsd/ipf/dist/lib/load_pool.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: load_pool.c,v 1.1.1.1 2012/03/23 21:20:09 christos Exp $ */
|
||||
/* $NetBSD: load_pool.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: load_pool.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
@ -34,16 +34,18 @@ load_pool(plp, iocfunc)
|
||||
op.iplo_size = sizeof(pool);
|
||||
op.iplo_struct = &pool;
|
||||
bzero((char *)&pool, sizeof(pool));
|
||||
pool.ipo_unit = plp->ipo_unit;
|
||||
strncpy(pool.ipo_name, plp->ipo_name, sizeof(pool.ipo_name));
|
||||
if (plp->ipo_name[0] == '\0')
|
||||
op.iplo_arg |= IPOOL_ANON;
|
||||
|
||||
if ((opts & OPT_REMOVE) == 0) {
|
||||
if (pool_ioctl(iocfunc, SIOCLOOKUPADDTABLE, &op))
|
||||
if (pool_ioctl(iocfunc, SIOCLOOKUPADDTABLE, &op)) {
|
||||
if ((opts & OPT_DONOTHING) == 0) {
|
||||
perror("load_pool:SIOCLOOKUPADDTABLE");
|
||||
return -1;
|
||||
return ipf_perror_fd(pool_fd(), iocfunc,
|
||||
"add lookup table");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (op.iplo_arg & IPOOL_ANON)
|
||||
@ -62,8 +64,8 @@ load_pool(plp, iocfunc)
|
||||
if ((opts & OPT_REMOVE) != 0) {
|
||||
if (pool_ioctl(iocfunc, SIOCLOOKUPDELTABLE, &op))
|
||||
if ((opts & OPT_DONOTHING) == 0) {
|
||||
perror("load_pool:SIOCLOOKUPDELTABLE");
|
||||
return -1;
|
||||
return ipf_perror_fd(pool_fd(), iocfunc,
|
||||
"delete lookup table");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
24
external/bsd/ipf/dist/lib/load_poolnode.c
vendored
24
external/bsd/ipf/dist/lib/load_poolnode.c
vendored
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: load_poolnode.c,v 1.1.1.1 2012/03/23 21:20:08 christos Exp $ */
|
||||
/* $NetBSD: load_poolnode.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011 by Darren Reed.
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
*
|
||||
* See the IPFILTER.LICENCE file for details on licencing.
|
||||
*
|
||||
* Id
|
||||
* $Id: load_poolnode.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
@ -25,6 +25,7 @@ load_poolnode(role, name, node, ttl, iocfunc)
|
||||
{
|
||||
ip_pool_node_t pn;
|
||||
iplookupop_t op;
|
||||
char *what;
|
||||
int err;
|
||||
|
||||
if (pool_open() == -1)
|
||||
@ -46,19 +47,22 @@ load_poolnode(role, name, node, ttl, iocfunc)
|
||||
pn.ipn_die = ttl;
|
||||
strncpy(pn.ipn_name, node->ipn_name, sizeof(pn.ipn_name));
|
||||
|
||||
if ((opts & OPT_REMOVE) == 0)
|
||||
if ((opts & OPT_REMOVE) == 0) {
|
||||
what = "add";
|
||||
err = pool_ioctl(iocfunc, SIOCLOOKUPADDNODE, &op);
|
||||
else
|
||||
} else {
|
||||
what = "delete";
|
||||
err = pool_ioctl(iocfunc, SIOCLOOKUPDELNODE, &op);
|
||||
}
|
||||
|
||||
if (err != 0) {
|
||||
if ((opts & OPT_DONOTHING) == 0) {
|
||||
fprintf(stderr, "load_loopnode(%s/",
|
||||
char msg[80];
|
||||
|
||||
sprintf(msg, "%s pool node(%s/", what,
|
||||
inet_ntoa(pn.ipn_addr.adf_addr.in4));
|
||||
fprintf(stderr, "%s",
|
||||
inet_ntoa(pn.ipn_mask.adf_addr.in4));
|
||||
perror(":SIOCLOOKUP*NODE");
|
||||
return -1;
|
||||
strcat(msg, inet_ntoa(pn.ipn_mask.adf_addr.in4));
|
||||
return ipf_perror_fd(pool_fd(), iocfunc, msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user