* [PATCH] libip6t_frag.c
@ 2003-09-05 6:48 Stephane Ouellette
2003-09-05 12:55 ` Harald Welte
0 siblings, 1 reply; 2+ messages in thread
From: Stephane Ouellette @ 2003-09-05 6:48 UTC (permalink / raw)
To: Harald Welte; +Cc: Netfilter Mailing List
[-- Attachment #1: Type: text/plain, Size: 140 bytes --]
Harald,
the following patch includes:
1- printf() simplifications,
2- indentation fixes,
3- C99 initializers.
Please apply.
Stephane
[-- Attachment #2: libip6t_frag.c.patch --]
[-- Type: text/plain, Size: 3606 bytes --]
--- netfilter.orig/userspace/extensions/libip6t_frag.c Wed May 29 09:08:16 2002
+++ netfilter/userspace/extensions/libip6t_frag.c Mon Aug 11 22:09:46 2003
@@ -24,13 +24,13 @@
}
static struct option opts[] = {
- { "fragid", 1, 0, '1' },
- { "fraglen", 1, 0, '2' },
- { "fragres", 0, 0, '3' },
- { "fragfirst", 0, 0, '4' },
- { "fragmore", 0, 0, '5' },
- { "fraglast", 0, 0, '6' },
- {0}
+ { .name = "fragid", .has_arg = 1, .flag = 0, .val = '1' },
+ { .name = "fraglen", .has_arg = 1, .flag = 0, .val = '2' },
+ { .name = "fragres", .has_arg = 0, .flag = 0, .val = '3' },
+ { .name = "fragfirst", .has_arg = 0, .flag = 0, .val = '4' },
+ { .name = "fragmore", .has_arg = 0, .flag = 0, .val = '5' },
+ { .name = "fraglast", .has_arg = 0, .flag = 0, .val = '6' },
+ { .name = 0 }
};
static u_int32_t
@@ -39,7 +39,7 @@
unsigned long int id;
char* ep;
- id = strtoul(idstr,&ep,0) ;
+ id = strtoul(idstr, &ep, 0);
if ( idstr == ep ) {
exit_error(PARAMETER_PROBLEM,
@@ -171,16 +171,10 @@
if (min != 0 || max != 0xFFFFFFFF || invert) {
printf("%s", name);
- if (min == max) {
- printf(":%s", inv);
- printf("%u", min);
- } else {
- printf("s:%s", inv);
- printf("%u",min);
- printf(":");
- printf("%u",max);
- }
- printf(" ");
+ if (min == max)
+ printf(":%s%u ", inv, min);
+ else
+ printf("s:%s%u:%u ", inv, min, max);
}
}
@@ -194,16 +188,25 @@
printf("frag ");
print_ids("id", frag->ids[0], frag->ids[1],
frag->invflags & IP6T_FRAG_INV_IDS);
+
if (frag->flags & IP6T_FRAG_LEN) {
- printf("length");
- printf(":%s", frag->invflags & IP6T_FRAG_INV_LEN ? "!" : "");
- printf("%u", frag->hdrlen);
- printf(" ");
- }
- if (frag->flags & IP6T_FRAG_RES) printf("reserved ");
- if (frag->flags & IP6T_FRAG_FST) printf("first ");
- if (frag->flags & IP6T_FRAG_MF) printf("more ");
- if (frag->flags & IP6T_FRAG_NMF) printf("last ");
+ printf("length:%s%u ",
+ frag->invflags & IP6T_FRAG_INV_LEN ? "!" : "",
+ frag->hdrlen);
+ }
+
+ if (frag->flags & IP6T_FRAG_RES)
+ printf("reserved ");
+
+ if (frag->flags & IP6T_FRAG_FST)
+ printf("first ");
+
+ if (frag->flags & IP6T_FRAG_MF)
+ printf("more ");
+
+ if (frag->flags & IP6T_FRAG_NMF)
+ printf("last ");
+
if (frag->invflags & ~IP6T_FRAG_INV_MASK)
printf("Unknown invflags: 0x%X ",
frag->invflags & ~IP6T_FRAG_INV_MASK);
@@ -234,27 +237,32 @@
fraginfo->hdrlen);
}
- if (fraginfo->flags & IP6T_FRAG_RES) printf("--fragres ");
- if (fraginfo->flags & IP6T_FRAG_FST) printf("--fragfirst ");
- if (fraginfo->flags & IP6T_FRAG_MF) printf("--fragmore ");
- if (fraginfo->flags & IP6T_FRAG_NMF) printf("--fraglast ");
+ if (fraginfo->flags & IP6T_FRAG_RES)
+ printf("--fragres ");
+
+ if (fraginfo->flags & IP6T_FRAG_FST)
+ printf("--fragfirst ");
+
+ if (fraginfo->flags & IP6T_FRAG_MF)
+ printf("--fragmore ");
+ if (fraginfo->flags & IP6T_FRAG_NMF)
+ printf("--fraglast ");
}
static
-struct ip6tables_match frag
-= { NULL,
- "frag",
- IPTABLES_VERSION,
- IP6T_ALIGN(sizeof(struct ip6t_frag)),
- IP6T_ALIGN(sizeof(struct ip6t_frag)),
- &help,
- &init,
- &parse,
- &final_check,
- &print,
- &save,
- opts
+struct ip6tables_match frag = {
+ .name = "frag",
+ .version = IPTABLES_VERSION,
+ .size = IP6T_ALIGN(sizeof(struct ip6t_frag)),
+ .userspacesize = IP6T_ALIGN(sizeof(struct ip6t_frag)),
+ .help = &help,
+ .init = &init,
+ .parse = &parse,
+ .final_check = &final_check,
+ .print = &print,
+ .save = &save,
+ .extra_opts = opts
};
void
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] libip6t_frag.c
2003-09-05 6:48 [PATCH] libip6t_frag.c Stephane Ouellette
@ 2003-09-05 12:55 ` Harald Welte
0 siblings, 0 replies; 2+ messages in thread
From: Harald Welte @ 2003-09-05 12:55 UTC (permalink / raw)
To: Stephane Ouellette; +Cc: Netfilter Mailing List
[-- Attachment #1: Type: text/plain, Size: 630 bytes --]
On Fri, Sep 05, 2003 at 02:48:05AM -0400, Stephane Ouellette wrote:
> Harald,
>
> the following patch includes:
>
> 1- printf() simplifications,
> 2- indentation fixes,
> 3- C99 initializers.
>
> Please apply.
thanks, applied.
> Stephane
--
- Harald Welte <laforge@netfilter.org> http://www.netfilter.org/
============================================================================
"Fragmentation is like classful addressing -- an interesting early
architectural error that shows how much experimentation was going
on while IP was being designed." -- Paul Vixie
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-09-05 12:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-05 6:48 [PATCH] libip6t_frag.c Stephane Ouellette
2003-09-05 12:55 ` Harald Welte
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.