netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Michael Richardson <mcr@sandelman.ottawa.on.ca>
Cc: netdev@vger.kernel.org, netfilter-devel@lists.netfilter.org,
	shemminger@osdl.org
Subject: Re: [PATCH] iproute2 -- add fwmarkmask
Date: Mon, 20 Feb 2006 18:03:04 +0100	[thread overview]
Message-ID: <43F9F648.1060803@trash.net> (raw)
In-Reply-To: <23395.1140452828@sandelman.ottawa.on.ca>

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 :)

  reply	other threads:[~2006-02-20 17:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-20 16:27 [PATCH] iproute2 -- add fwmarkmask Michael Richardson
2006-02-20 17:03 ` Patrick McHardy [this message]
2006-02-23 19:39   ` Michael Richardson
2006-02-24  4:59     ` Patrick McHardy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43F9F648.1060803@trash.net \
    --to=kaber@trash.net \
    --cc=mcr@sandelman.ottawa.on.ca \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@lists.netfilter.org \
    --cc=shemminger@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).