003 File Manager
Current Path:
/usr/src/contrib/ipfilter/lib
usr
/
src
/
contrib
/
ipfilter
/
lib
/
📁
..
📄
Makefile
(18.78 KB)
📄
addicmp.c
(446 B)
📄
addipopt.c
(1.14 KB)
📄
alist_free.c
(334 B)
📄
alist_new.c
(1.59 KB)
📄
allocmbt.c
(383 B)
📄
assigndefined.c
(452 B)
📄
bcopywrap.c
(274 B)
📄
binprint.c
(411 B)
📄
buildopts.c
(823 B)
📄
checkrev.c
(803 B)
📄
connecttcp.c
(911 B)
📄
count4bits.c
(621 B)
📄
count6bits.c
(376 B)
📄
debug.c
(556 B)
📄
dupmbt.c
(482 B)
📄
facpri.c
(2.62 KB)
📄
facpri.h
(629 B)
📄
familyname.c
(184 B)
📄
fill6bits.c
(744 B)
📄
findword.c
(413 B)
📄
flags.c
(414 B)
📄
freembt.c
(233 B)
📄
ftov.c
(204 B)
📄
gethost.c
(1.42 KB)
📄
geticmptype.c
(452 B)
📄
getifname.c
(957 B)
📄
getnattype.c
(1.15 KB)
📄
getport.c
(1.75 KB)
📄
getportproto.c
(621 B)
📄
getproto.c
(462 B)
📄
getsumd.c
(344 B)
📄
hostname.c
(1.2 KB)
📄
icmpcode.c
(493 B)
📄
icmptypename.c
(494 B)
📄
icmptypes.c
(3.34 KB)
📄
inet_addr.c
(6.1 KB)
📄
initparse.c
(300 B)
📄
interror.c
(26.29 KB)
📄
ionames.c
(1.57 KB)
📄
ipf_dotuning.c
(1.61 KB)
📄
ipf_perror.c
(698 B)
📄
ipft_hx.c
(3.13 KB)
📄
ipft_pc.c
(4.41 KB)
📄
ipft_tx.c
(10.09 KB)
📄
ipoptsec.c
(1.15 KB)
📄
kmem.c
(1.85 KB)
📄
kmem.h
(504 B)
📄
kmemcpywrap.c
(314 B)
📄
kvatoname.c
(672 B)
📄
load_dstlist.c
(1.65 KB)
📄
load_dstlistnode.c
(1.47 KB)
📄
load_file.c
(1.56 KB)
📄
load_hash.c
(2.29 KB)
📄
load_hashnode.c
(1.35 KB)
📄
load_http.c
(4.02 KB)
📄
load_pool.c
(1.59 KB)
📄
load_poolnode.c
(1.4 KB)
📄
load_url.c
(542 B)
📄
mb_hexdump.c
(541 B)
📄
msgdsize.c
(333 B)
📄
mutex_emul.c
(2.66 KB)
📄
nametokva.c
(645 B)
📄
nat_setgroupmap.c
(756 B)
📄
ntomask.c
(635 B)
📄
optname.c
(1.13 KB)
📄
optprint.c
(1.73 KB)
📄
optprintv6.c
(894 B)
📄
optvalue.c
(520 B)
📄
parsefields.c
(984 B)
📄
parseipfexpr.c
(6.19 KB)
📄
parsewhoisline.c
(2.72 KB)
📄
poolio.c
(704 B)
📄
portname.c
(902 B)
📄
prependmbt.c
(307 B)
📄
print_toif.c
(882 B)
📄
printactiveaddr.c
(643 B)
📄
printactivenat.c
(4.18 KB)
📄
printaddr.c
(1.16 KB)
📄
printaps.c
(3.53 KB)
📄
printbuf.c
(414 B)
📄
printdstl_live.c
(1.72 KB)
📄
printdstlist.c
(1.04 KB)
📄
printdstlistdata.c
(974 B)
📄
printdstlistnode.c
(1.73 KB)
📄
printdstlistpolicy.c
(454 B)
📄
printfieldhdr.c
(972 B)
📄
printfr.c
(10.73 KB)
📄
printfraginfo.c
(801 B)
📄
printhash.c
(1.04 KB)
📄
printhash_live.c
(1.4 KB)
📄
printhashdata.c
(1.93 KB)
📄
printhashnode.c
(2.32 KB)
📄
printhost.c
(553 B)
📄
printhostmap.c
(626 B)
📄
printhostmask.c
(612 B)
📄
printifname.c
(339 B)
📄
printip.c
(690 B)
📄
printipfexpr.c
(3.58 KB)
📄
printiphdr.c
(462 B)
📄
printlog.c
(650 B)
📄
printlookup.c
(700 B)
📄
printmask.c
(450 B)
📄
printnat.c
(8.69 KB)
📄
printnataddr.c
(992 B)
📄
printnatfield.c
(3.2 KB)
📄
printnatside.c
(2.51 KB)
📄
printpacket.c
(2.06 KB)
📄
printpacket6.c
(1.29 KB)
📄
printpool.c
(1.2 KB)
📄
printpool_live.c
(1.39 KB)
📄
printpooldata.c
(1.08 KB)
📄
printpoolfield.c
(3.42 KB)
📄
printpoolnode.c
(1.66 KB)
📄
printportcmp.c
(632 B)
📄
printproto.c
(750 B)
📄
printsbuf.c
(542 B)
📄
printstate.c
(5.74 KB)
📄
printstatefields.c
(5.24 KB)
📄
printtcpflags.c
(451 B)
📄
printtqtable.c
(430 B)
📄
printtunable.c
(649 B)
📄
printunit.c
(652 B)
📄
remove_hash.c
(1 KB)
📄
remove_hashnode.c
(1.11 KB)
📄
remove_pool.c
(947 B)
📄
remove_poolnode.c
(1.08 KB)
📄
resetlexer.c
(331 B)
📄
rwlock_emul.c
(3.47 KB)
📄
save_execute.c
(1.14 KB)
📄
save_file.c
(1.88 KB)
📄
save_nothing.c
(821 B)
📄
save_syslog.c
(2.2 KB)
📄
save_v1trap.c
(7.93 KB)
📄
save_v2trap.c
(7.98 KB)
📄
tcp_flags.c
(770 B)
📄
tcpflags.c
(594 B)
📄
tcpoptnames.c
(513 B)
📄
v6ionames.c
(636 B)
📄
v6optvalue.c
(577 B)
📄
var.c
(2.92 KB)
📄
verbose.c
(511 B)
📄
vtof.c
(204 B)
Editing: printstate.c
/* $FreeBSD$ */ /* * Copyright (C) 2012 by Darren Reed. * * See the IPFILTER.LICENCE file for details on licencing. */ #include "ipf.h" #include "kmem.h" ipstate_t * printstate(ipstate_t *sp, int opts, u_long now) { struct protoent *pr; synclist_t ipsync; if ((opts & OPT_NORESOLVE) == 0) pr = getprotobynumber(sp->is_p); else pr = NULL; PRINTF("%d:", sp->is_v); if (pr != NULL) PRINTF("%s", pr->p_name); else PRINTF("%d", sp->is_p); PRINTF(" src:%s", hostname(sp->is_family, &sp->is_src.in4)); if (sp->is_p == IPPROTO_UDP || sp->is_p == IPPROTO_TCP) { if (sp->is_flags & IS_WSPORT) PRINTF(",*"); else PRINTF(",%d", ntohs(sp->is_sport)); } PRINTF(" dst:%s", hostname(sp->is_family, &sp->is_dst.in4)); if (sp->is_p == IPPROTO_UDP || sp->is_p == IPPROTO_TCP) { if (sp->is_flags & IS_WDPORT) PRINTF(",*"); else PRINTF(",%d", ntohs(sp->is_dport)); } if (sp->is_p == IPPROTO_TCP) { PRINTF(" state:%d/%d", sp->is_state[0], sp->is_state[1]); } PRINTF(" %ld", sp->is_die - now); if (sp->is_phnext == NULL) PRINTF(" ORPHAN"); if (sp->is_flags & IS_CLONE) PRINTF(" CLONE"); putchar('\n'); if (sp->is_p == IPPROTO_TCP) { PRINTF("\t%x:%x %hu<<%d:%hu<<%d\n", sp->is_send, sp->is_dend, sp->is_maxswin, sp->is_swinscale, sp->is_maxdwin, sp->is_dwinscale); if ((opts & OPT_VERBOSE) != 0) { PRINTF("\tcmsk %04x smsk %04x isc %p s0 %08x/%08x\n", sp->is_smsk[0], sp->is_smsk[1], sp->is_isc, sp->is_s0[0], sp->is_s0[1]); PRINTF("\tFWD: ISN inc %x sumd %x\n", sp->is_isninc[0], sp->is_sumd[0]); PRINTF("\tREV: ISN inc %x sumd %x\n", sp->is_isninc[1], sp->is_sumd[1]); #ifdef IPFILTER_SCAN PRINTF("\tsbuf[0] ["); printsbuf(sp->is_sbuf[0]); PRINTF("] sbuf[1] ["); printsbuf(sp->is_sbuf[1]); PRINTF("]\n"); #endif } } else if (sp->is_p == IPPROTO_GRE) { PRINTF("\tcall %hx/%hx\n", ntohs(sp->is_gre.gs_call[0]), ntohs(sp->is_gre.gs_call[1])); } else if (sp->is_p == IPPROTO_ICMP #ifdef USE_INET6 || sp->is_p == IPPROTO_ICMPV6 #endif ) { PRINTF("\tid %hu seq %hu type %d\n", sp->is_icmp.ici_id, sp->is_icmp.ici_seq, sp->is_icmp.ici_type); } #ifdef USE_QUAD_T PRINTF("\tFWD: IN pkts %"PRIu64" bytes %"PRIu64" OUT pkts %"PRIu64" bytes %"PRIu64"\n\tREV: IN pkts %"PRIu64" bytes %"PRIu64" OUT pkts %"PRIu64" bytes %"PRIu64"\n", sp->is_pkts[0], sp->is_bytes[0], sp->is_pkts[1], sp->is_bytes[1], sp->is_pkts[2], sp->is_bytes[2], sp->is_pkts[3], sp->is_bytes[3]); #else PRINTF("\tFWD: IN pkts %lu bytes %lu OUT pkts %lu bytes %lu\n\tREV: IN pkts %lu bytes %lu OUT pkts %lu bytes %lu\n", sp->is_pkts[0], sp->is_bytes[0], sp->is_pkts[1], sp->is_bytes[1], sp->is_pkts[2], sp->is_bytes[2], sp->is_pkts[3], sp->is_bytes[3]); #endif PRINTF("\ttag %u pass %#x = ", sp->is_tag, sp->is_pass); /* * Print out bits set in the result code for the state being * kept as they would for a rule. */ if (FR_ISPASS(sp->is_pass)) { PRINTF("pass"); } else if (FR_ISBLOCK(sp->is_pass)) { PRINTF("block"); switch (sp->is_pass & FR_RETMASK) { case FR_RETICMP : PRINTF(" return-icmp"); break; case FR_FAKEICMP : PRINTF(" return-icmp-as-dest"); break; case FR_RETRST : PRINTF(" return-rst"); break; default : break; } } else if ((sp->is_pass & FR_LOGMASK) == FR_LOG) { PRINTF("log"); if (sp->is_pass & FR_LOGBODY) PRINTF(" body"); if (sp->is_pass & FR_LOGFIRST) PRINTF(" first"); } else if (FR_ISACCOUNT(sp->is_pass)) { PRINTF("count"); } else if (FR_ISPREAUTH(sp->is_pass)) { PRINTF("preauth"); } else if (FR_ISAUTH(sp->is_pass)) PRINTF("auth"); if (sp->is_pass & FR_OUTQUE) PRINTF(" out"); else PRINTF(" in"); if ((sp->is_pass & FR_LOG) != 0) { PRINTF(" log"); if (sp->is_pass & FR_LOGBODY) PRINTF(" body"); if (sp->is_pass & FR_LOGFIRST) PRINTF(" first"); if (sp->is_pass & FR_LOGORBLOCK) PRINTF(" or-block"); } if (sp->is_pass & FR_QUICK) PRINTF(" quick"); if (sp->is_pass & FR_KEEPFRAG) PRINTF(" keep frags"); /* a given; no? */ if (sp->is_pass & FR_KEEPSTATE) { PRINTF(" keep state"); if (sp->is_pass & (FR_STATESYNC|FR_STSTRICT|FR_STLOOSE)) { PRINTF(" ("); if (sp->is_pass & FR_STATESYNC) PRINTF(" sync"); if (sp->is_pass & FR_STSTRICT) PRINTF(" strict"); if (sp->is_pass & FR_STLOOSE) PRINTF(" loose"); PRINTF(" )"); } } PRINTF("\n"); if ((opts & OPT_VERBOSE) != 0) { PRINTF("\tref %d", sp->is_ref); PRINTF(" pkt_flags & %x(%x) = %x\n", sp->is_flags & 0xf, sp->is_flags, sp->is_flags >> 4); PRINTF("\tpkt_options & %x = %x, %x = %x \n", sp->is_optmsk[0], sp->is_opt[0], sp->is_optmsk[1], sp->is_opt[1]); PRINTF("\tpkt_security & %x = %x, pkt_auth & %x = %x\n", sp->is_secmsk, sp->is_sec, sp->is_authmsk, sp->is_auth); PRINTF("\tis_flx %#x %#x %#x %#x\n", sp->is_flx[0][0], sp->is_flx[0][1], sp->is_flx[1][0], sp->is_flx[1][1]); } PRINTF("\tinterfaces: in %s[%s", getifname(sp->is_ifp[0]), sp->is_ifname[0]); if (opts & OPT_DEBUG) PRINTF("/%p", sp->is_ifp[0]); putchar(']'); PRINTF(",%s[%s", getifname(sp->is_ifp[1]), sp->is_ifname[1]); if (opts & OPT_DEBUG) PRINTF("/%p", sp->is_ifp[1]); putchar(']'); PRINTF(" out %s[%s", getifname(sp->is_ifp[2]), sp->is_ifname[2]); if (opts & OPT_DEBUG) PRINTF("/%p", sp->is_ifp[2]); putchar(']'); PRINTF(",%s[%s", getifname(sp->is_ifp[3]), sp->is_ifname[3]); if (opts & OPT_DEBUG) PRINTF("/%p", sp->is_ifp[3]); PRINTF("]\n"); PRINTF("\tSync status: "); if (sp->is_sync != NULL) { if (kmemcpy((char *)&ipsync, (u_long)sp->is_sync, sizeof(ipsync))) { PRINTF("status could not be retrieved\n"); return (NULL); } PRINTF("idx %d num %d v %d pr %d rev %d\n", ipsync.sl_idx, ipsync.sl_num, ipsync.sl_v, ipsync.sl_p, ipsync.sl_rev); } else { PRINTF("not synchronized\n"); } return (sp->is_next); }
Upload File
Create Folder