netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: mateusz.bajorski@nokia.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] Added NLM_F_EXCL support to fib_nl_newrule
Date: Mon, 23 May 2016 14:29:40 -0700 (PDT)	[thread overview]
Message-ID: <20160523.142940.559311739401468603.davem@davemloft.net> (raw)
In-Reply-To: <573F341F.7020302@nokia.com>

From: Mateusz Bajorski <mateusz.bajorski@nokia.com>
Date: Fri, 20 May 2016 17:58:23 +0200


Please format your Subject line properly, it should be of the form:

	[PATCH] $SUBSYSTEM: Description.

In this case "fib_fules: " would be an appropriate subsystem
specification.

> diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
> index 840aceb..b9816a3 100644
> --- a/net/core/fib_rules.c
> +++ b/net/core/fib_rules.c
> @@ -291,6 +291,47 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh)
>  	if (err < 0)
>  		goto errout;
>  
> +	if (nlh->nlmsg_flags & NLM_F_EXCL) {
> +		list_for_each_entry(rule, &ops->rules_list, list) {
> +			if (frh->action && (frh->action != rule->action))
> +				continue;
> +
> +			if (frh_get_table(frh, tb) &&
> +				frh_get_table(frh, tb) != rule->table)
> +				continue;

First of all, this is not indented properly.

When a conditional, or function call, spans multiple lines, the second
and subsequent lines must be indented precisely to the first column
after the openning parenthesis of the first line.  You must use the
appropriate number of TAB and SPACE characters necessary to do so.

Second of all, this is so messy having to check the 'tb' pointers over
and over again each iteration of the loop.

It's therefore much better to put this check later in the function long
after we've built the whole new rule, right before we do the priority
ordering loop.

      reply	other threads:[~2016-05-23 21:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-20 15:58 [PATCH] Added NLM_F_EXCL support to fib_nl_newrule Mateusz Bajorski
2016-05-23 21:29 ` David Miller [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=20160523.142940.559311739401468603.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=mateusz.bajorski@nokia.com \
    --cc=netdev@vger.kernel.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).