Re: [PATCH] iproute2 -- add fwmarkmask
From: Patrick McHardy <hidden>
Date: 2006-02-20 17:03:04
Also in:
netfilter-devel
From: Patrick McHardy <hidden>
Date: 2006-02-20 17:03:04
Also in:
netfilter-devel
Michael Richardson wrote:
- if (tb[RTA_PROTOINFO]) {
- fprintf(fp, "fwmark %#x ", *(__u32*)RTA_DATA(tb[RTA_PROTOINFO]));
+ if (tb[RTA_FWMARK]) {
+ __u32 value = *(__u32*)RTA_DATA(tb[RTA_PROTOINFO]);
+ if (tb[RTA_FWMARK_MASK]) {
+ __u32 mask;
+ mask=*(__u32*)RTA_DATA(tb[RTA_FWMARK_MASK]);
+ fprintf(fp, "fwmark %#x&%#x ", value, mask);The normal way to display masks is with a "/". Also I think it shouldn't display the default mask to avoid breaking scripts that parse the output.
+ } else if (strcmp(*argv, "fwmarkmask") == 0) {
+ __u32 fwmarkmask;
+ NEXT_ARG();
+ if (get_u32(&fwmarkmask, *argv, 0))
+ invarg("fwmarkmask value is invalid\n", *argv);
+ addattr32(&req.n, sizeof(req), RTA_FWMARK_MASK, fwmarkmask);ip should be able to parse its own output, and it would also look nicer if I could just say "fwmark 0x1/32". fwmarkmask is really an incredible ugly expression :)