netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Donald Sharp <sharpd@cumulusnetworks.com>,
	netdev@vger.kernel.org, dsahern@gmail.com
Subject: Re: [PATCH iproute2-next 1/4] ip: Use the `struct fib_rule_hdr` for rules
Date: Wed, 21 Feb 2018 10:04:00 -0700	[thread overview]
Message-ID: <ab27c331-407f-4727-9b8a-96fff45c98b1@gmail.com> (raw)
In-Reply-To: <20180221015348.32646-2-sharpd@cumulusnetworks.com>

On 2/20/18 6:53 PM, Donald Sharp wrote:
> @@ -159,7 +159,13 @@ static bool filter_nlmsg(struct nlmsghdr *n, struct rtattr **tb, int host_len)
>  			return false;
>  	}
>  
> -	table = rtm_get_table(r, tb);
> +
> +	/* struct fib_rule_hdr and struct rtmsg
> +	 * were intentionally the same.  Since
> +	 * the table is the rtm_table, just call
> +	 * it.
> +	 */
> +	table = rtm_get_table((struct rtmsg *)frh, tb);
>  	if (filter.tb > 0 && filter.tb ^ table)
>  		return false;
>  
...

> @@ -273,7 +279,12 @@ int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
>  		fprintf(fp, "uidrange %u-%u ", r->start, r->end);
>  	}
>  
> -	table = rtm_get_table(r, tb);
> +	/* struct fib_rule_hdr and struct rtmsg
> +	 * were intentionally the same.  Since
> +	 * the table is the rtm_table, just call
> +	 * it.
> +	 */
> +	table = rtm_get_table((struct rtmsg *)frh, tb);
>  	if (table) {
>  		fprintf(fp, "lookup %s ",
>  			rtnl_rttable_n2a(table, b1, sizeof(b1)));

I would rather have a second get_table function than use the typecast;
frh_get_table() that mirrors rtm_get_table.

Thanks for taking the time to fix the ancillary header struct.

      reply	other threads:[~2018-02-21 17:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-21  1:53 [PATCH iproute2-next 1/4] ip: Use the `struct fib_rule_hdr` for rules Donald Sharp
2018-02-21 17:04 ` David Ahern [this message]

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=ab27c331-407f-4727-9b8a-96fff45c98b1@gmail.com \
    --to=dsahern@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=sharpd@cumulusnetworks.com \
    /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).