FreeBSD Bugzilla – Attachment 259 Details for
Bug 1220
IPFW: configuration utility enhancements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 4.55 KB, created by
Alex Nash
on 1996-05-19 23:30:08 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Alex Nash
Created:
1996-05-19 23:30:08 UTC
Size:
4.55 KB
patch
obsolete
>*** 27,32 **** >--- 27,33 ---- > #include <stdlib.h> > #include <netdb.h> > #include <limits.h> >+ #include <time.h> > #include <sys/queue.h> > #include <sys/socket.h> > #include <netinet/in.h> >*************** >*** 40,45 **** >--- 41,47 ---- > int s; /* main RAW socket */ > int do_resolv=0; /* Would try to resolv all */ > int do_acct=0; /* Show packet/byte count */ >+ int do_time=0; /* Show time stamps */ > > int > mask_bits(m_ad) >*************** >*** 77,82 **** >--- 79,98 ---- > if (do_acct) > printf("%10lu %10lu ",chain->fw_pcnt,chain->fw_bcnt); > >+ if (do_time) >+ { >+ if (chain->timestamp) >+ { >+ char timestr[30]; >+ >+ strcpy(timestr, ctime((time_t *)&chain->timestamp)); >+ *strchr(timestr, '\n') = '\0'; >+ printf("%s ", timestr); >+ } >+ else >+ printf(" "); >+ } >+ > if (chain->fw_flg & IP_FW_F_ACCEPT) > printf("allow"); > else if (chain->fw_flg & IP_FW_F_ICMPRPL) >*************** >*** 242,247 **** >--- 258,276 ---- > if (chain->fw_tcpf & IP_FW_TCPF_URG) PRINTFLG("urg"); > if (chain->fw_tcpnf & IP_FW_TCPF_URG) PRINTFLG("!urg"); > } >+ if (chain->fw_flg & IP_FW_F_ICMPBIT) { >+ int type_index; >+ int first = 1; >+ >+ printf(" icmptype"); >+ >+ for (type_index = 0; type_index < 256; ++type_index) >+ if (chain->fw_icmptypes[type_index / (sizeof(unsigned) * 8)] & >+ (1U << (type_index % (sizeof(unsigned) * 8)))) { >+ printf("%c%d", first == 1 ? ' ' : ',', type_index); >+ first = 0; >+ } >+ } > printf("\n"); > } > >*************** >*** 288,295 **** > "\t\t{in|out|inout}\n" > "\t\tvia {ifname|ip}\n" > "\t\t{established|setup}\n" >! "\t\ttcpflags [!]{syn|fin|rst|ack|psh},...\n" > "\t\tipoptions [!]{ssrr|lsrr|rr|ts},...\n" > , progname > ); > >--- 317,325 ---- > "\t\t{in|out|inout}\n" > "\t\tvia {ifname|ip}\n" > "\t\t{established|setup}\n" >! "\t\ttcpflags [!]{syn|fin|rst|ack|psh|urg},...\n" > "\t\tipoptions [!]{ssrr|lsrr|rr|ts},...\n" >+ "\t\ticmptypes {type},...\n" > , progname > ); > >*************** >*** 385,390 **** >--- 415,433 ---- > u_char *d; > > while (p && *p) { >+ struct tpcflags { >+ char * name; >+ u_char value; >+ } flags[] = { >+ { "syn", IP_FW_TCPF_SYN }, >+ { "fin", IP_FW_TCPF_FIN }, >+ { "ack", IP_FW_TCPF_ACK }, >+ { "psh", IP_FW_TCPF_PSH }, >+ { "rst", IP_FW_TCPF_RST }, >+ { "urg", IP_FW_TCPF_URG } >+ }; >+ int i; >+ > if (*p == '!') { > p++; > d = reset; >*************** >*** 394,404 **** > q = strchr(p, ','); > if (q) > *q++ = '\0'; >! if (!strncmp(p,"syn",strlen(p))) *d |= IP_FW_TCPF_SYN; >! if (!strncmp(p,"fin",strlen(p))) *d |= IP_FW_TCPF_FIN; >! if (!strncmp(p,"ack",strlen(p))) *d |= IP_FW_TCPF_ACK; >! if (!strncmp(p,"psh",strlen(p))) *d |= IP_FW_TCPF_PSH; >! if (!strncmp(p,"rst",strlen(p))) *d |= IP_FW_TCPF_RST; > p = q; > } > } >--- 437,452 ---- > q = strchr(p, ','); > if (q) > *q++ = '\0'; >! >! for (i = 0; i < sizeof(flags) / sizeof(flags[0]); ++i) >! if (!strncmp(p, flags[i].name, strlen(p))) { >! *d |= flags[i].value; >! break; >! } >! >! if (i == sizeof(flags) / sizeof(flags[0])) >! show_usage("invalid tcp flag\n"); >! > p = q; > } > } >*************** >*** 430,435 **** >--- 478,512 ---- > } > > void >+ fill_icmptypes(types, vp, fw_flg) >+ u_long *types; >+ char **vp; >+ u_short *fw_flg; >+ { >+ char *c = *vp; >+ >+ while (*c) >+ { >+ unsigned long icmptype; >+ >+ if ( *c == ',' ) >+ ++c; >+ >+ icmptype = strtoul(c, &c, 0); >+ >+ if ( *c != ',' && *c != '\0' ) >+ show_usage("invalid ICMP type"); >+ >+ if (icmptype > 255) >+ show_usage("ICMP types are between 0 and 255 inclusive"); >+ >+ types[icmptype / (sizeof(unsigned) * 8)] |= >+ 1 << (icmptype % (sizeof(unsigned) * 8)); >+ *fw_flg |= IP_FW_F_ICMPBIT; >+ } >+ } >+ >+ void > delete(ac,av) > int ac; > char **av; >*************** >*** 579,584 **** >--- 656,668 ---- > av++; ac--; continue; > } > } >+ if ((rule.fw_flg & IP_FW_F_KIND) == IP_FW_F_ICMP) { >+ if (ac > 1 && !strncmp(*av,"icmptypes",strlen(*av))) { >+ av++; ac--; >+ fill_icmptypes(rule.fw_icmptypes, av, &rule.fw_flg); >+ av++; ac--; continue; >+ } >+ } > printf("%d %s\n",ac,*av); > show_usage("Unknown argument\n"); > } >*************** >*** 637,646 **** > show_usage(NULL); > } > >! while ((ch = getopt(ac, av ,"aN")) != EOF) > switch(ch) { > case 'a': > do_acct=1; > break; > case 'N': > do_resolv=1; >--- 721,733 ---- > show_usage(NULL); > } > >! while ((ch = getopt(ac, av ,"atN")) != EOF) > switch(ch) { > case 'a': > do_acct=1; >+ break; >+ case 't': >+ do_time=1; > break; > case 'N': > do_resolv=1;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1220
: 259 |
260