003 File Manager
Current Path:
/usr/src/contrib/ipfilter
usr
/
src
/
contrib
/
ipfilter
/
📁
..
📄
BNF
(3.52 KB)
📄
BugReport
(409 B)
📄
HISTORY
(55.43 KB)
📄
LICENCE
(612 B)
📄
Makefile
(14.48 KB)
📄
NAT.FreeBSD
(2.84 KB)
📄
README
(4.53 KB)
📄
STYLE.TXT
(1.96 KB)
📄
WhatsNew50.txt
(2.26 KB)
📄
Y2K
(48 B)
📄
arc4random.c
(5.03 KB)
📄
bpf-ipf.h
(13.72 KB)
📄
bpf_filter.c
(12.32 KB)
📄
genmask.c
(1.14 KB)
📄
ip_dstlist.c
(43.79 KB)
📄
ip_dstlist.h
(1.43 KB)
📄
ip_fil.c
(14.13 KB)
📄
ip_fil_compat.c
(122.12 KB)
📄
ip_msnrpc_pxy.c
(6.25 KB)
📄
ipf.h
(11.97 KB)
📄
ipf_rb.h
(10.37 KB)
📁
iplang
📄
ipmon.h
(3.27 KB)
📁
ipsend
📄
ipt.h
(536 B)
📄
kmem.h
(526 B)
📁
l4check
📁
lib
📁
man
📄
md5.c
(11.36 KB)
📄
md5.h
(3.11 KB)
📄
mkfilters
(2.62 KB)
📄
mlfk_rule.c
(1.23 KB)
📄
opt_inet6.h
(14 B)
📄
opts.h
(1.45 KB)
📄
pcap-ipf.h
(642 B)
📄
radix_ipf.c
(41.92 KB)
📄
radix_ipf.h
(2.64 KB)
📁
rules
📁
samples
📄
snoop.h
(664 B)
📁
sys
📁
tools
Editing: genmask.c
/* * Copyright (C) 2012 by Darren Reed. * * See the IPFILTER.LICENCE file for details on licencing. * * $Id$ */ #include "ipf.h" int genmask(family, msk, mskp) int family; char *msk; i6addr_t *mskp; { char *endptr = 0L; u_32_t addr; int bits; if (strchr(msk, '.') || strchr(msk, 'x') || strchr(msk, ':')) { /* possibly of the form xxx.xxx.xxx.xxx * or 0xYYYYYYYY */ switch (family) { #ifdef USE_INET6 case AF_INET6 : if (inet_pton(AF_INET6, msk, &mskp->in4) != 1) return -1; break; #endif case AF_INET : if (inet_aton(msk, &mskp->in4) == 0) return -1; break; default : return -1; /*NOTREACHED*/ } } else { /* * set x most significant bits */ bits = (int)strtol(msk, &endptr, 0); switch (family) { case AF_INET6 : if ((*endptr != '\0') || (bits < 0) || (bits > 128)) return -1; fill6bits(bits, mskp->i6); break; case AF_INET : if (*endptr != '\0' || bits > 32 || bits < 0) return -1; if (bits == 0) addr = 0; else addr = htonl(0xffffffff << (32 - bits)); mskp->in4.s_addr = addr; break; default : return -1; /*NOTREACHED*/ } } return 0; }
Upload File
Create Folder