FreeBSD Bugzilla – Attachment 8834 Details for
Bug 18351
ipfw add with no rule number returns the wrong rule number
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
ipfw.patch
ipfw.patch (text/plain; charset="us-ascii"), 1.77 KB, created by
darcy
on 2000-05-02 20:40:52 UTC
(
hide
)
Description:
ipfw.patch
Filename:
MIME Type:
Creator:
darcy
Created:
2000-05-02 20:40:52 UTC
Size:
1.77 KB
patch
obsolete
>*** ipfw.c.org Tue May 2 12:04:11 2000 >--- ipfw.c Tue May 2 12:02:28 2000 >*************** >*** 1281,1300 **** > int ac; > char **av; > { > struct ip_fw rule; > int i; > u_char proto; > struct protoent *pe; > int saw_xmrc = 0, saw_via = 0; >! > memset(&rule, 0, sizeof rule); > > av++; ac--; > > /* Rule number */ > if (ac && isdigit(**av)) { > rule.fw_number = atoi(*av); av++; ac--; > } > > /* Action */ > if (ac > 1 && !strncmp(*av, "prob", strlen(*av) ) ) { >--- 1281,1341 ---- > int ac; > char **av; > { >+ /* >+ struct ip_fw *rules; >+ >+ >+ void *data = NULL; >+ int pcwidth = 0; >+ int bcwidth = 0; >+ int n, num = 0; >+ >+ */ >+ struct dn_pipe *pipes; >+ int nbytes; >+ >+ > struct ip_fw rule; >+ struct ip_fw *rules; > int i; > u_char proto; > struct protoent *pe; >+ int num = 0; > int saw_xmrc = 0, saw_via = 0; >! void *data=NULL; > memset(&rule, 0, sizeof rule); > > av++; ac--; > >+ { >+ const int unit = do_pipe ? sizeof(*pipes) : sizeof(*rules); >+ const int ocmd = do_pipe ? IP_DUMMYNET_GET : IP_FW_GET; >+ int nalloc = 0; >+ >+ while (num >= nalloc) { >+ nalloc = nalloc * 2 + 200; >+ nbytes = nalloc * unit; >+ if ((data = realloc(data, nbytes)) == NULL) >+ err(EX_OSERR, "realloc"); >+ if (getsockopt(s, IPPROTO_IP, ocmd, data, &nbytes) < 0) >+ err(EX_OSERR, "getsockopt(IP_%s_GET)", >+ do_pipe ? "DUMMYNET" : "FW"); >+ num = nbytes / unit; >+ } >+ } >+ > /* Rule number */ > if (ac && isdigit(**av)) { > rule.fw_number = atoi(*av); av++; ac--; > } >+ else { >+ rules = (struct ip_fw *) data; >+ num = 0; >+ while (rules[num].fw_number < 65535){ >+ num++; >+ } >+ rule.fw_number = num; >+ } > > /* Action */ > if (ac > 1 && !strncmp(*av, "prob", strlen(*av) ) ) {
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 18351
: 8834