diff mbox

[net] ipv4: include NLM_F_APPEND flag in append route notifications

Message ID 1434471120-26742-1-git-send-email-roopa@cumulusnetworks.com
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Roopa Prabhu June 16, 2015, 4:11 p.m. UTC
From: Roopa Prabhu <roopa@cumulusnetworks.com>

This patch adds NLM_F_APPEND flag to struct nlmsg_hdr->nlmsg_flags
in newroute notifications if the route add was an append.
(This is similar to how NLM_F_REPLACE is already part of new
route replace notifications today)

This helps userspace determine if the route add operation was
an append.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
 net/ipv4/fib_trie.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Roopa Prabhu June 16, 2015, 4:14 p.m. UTC | #1
On 6/16/15, 9:11 AM, Roopa Prabhu wrote:
> From: Roopa Prabhu <roopa@cumulusnetworks.com>
>
> This patch adds NLM_F_APPEND flag to struct nlmsg_hdr->nlmsg_flags
> in newroute notifications if the route add was an append.
> (This is similar to how NLM_F_REPLACE is already part of new
> route replace notifications today)
>
> This helps userspace determine if the route add operation was
> an append.
>
> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
please ignore, I plan to resend the patch against net-next
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Scott Feldman June 17, 2015, 7:50 a.m. UTC | #2
On Tue, Jun 16, 2015 at 9:11 AM, Roopa Prabhu <roopa@cumulusnetworks.com> wrote:

[snip]

> @@ -1203,6 +1204,8 @@ int fib_table_insert(struct fib_table *tb, struct fib_config *cfg)
>
>                 if (!(cfg->fc_nlflags & NLM_F_APPEND))
>                         fa = fa_first;
> +               else
> +                       nlflags |= NLM_F_APPEND;
>         }

The if and else parts above don't seem logically related.  Maybe you
could initialize nlflags as:

    unsigned int nlflags = cfg->fc_nlflags & (NLM_F_REPLACE|NLM_F_APPEND);

And then pass rtmsg_fib(..., nlflags) to avoid the flag test/set?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 3c699c4..38ffc20 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1082,6 +1082,7 @@  int fib_table_insert(struct fib_table *tb, struct fib_config *cfg)
 	struct trie *t = (struct trie *)tb->tb_data;
 	struct fib_alias *fa, *new_fa;
 	struct key_vector *l, *tp;
+	unsigned int nlflags = 0;
 	struct fib_info *fi;
 	u8 plen = cfg->fc_dst_len;
 	u8 slen = KEYLENGTH - plen;
@@ -1203,6 +1204,8 @@  int fib_table_insert(struct fib_table *tb, struct fib_config *cfg)
 
 		if (!(cfg->fc_nlflags & NLM_F_APPEND))
 			fa = fa_first;
+		else
+			nlflags |= NLM_F_APPEND;
 	}
 	err = -ENOENT;
 	if (!(cfg->fc_nlflags & NLM_F_CREATE))
@@ -1238,7 +1241,7 @@  int fib_table_insert(struct fib_table *tb, struct fib_config *cfg)
 
 	rt_cache_flush(cfg->fc_nlinfo.nl_net);
 	rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, new_fa->tb_id,
-		  &cfg->fc_nlinfo, 0);
+		  &cfg->fc_nlinfo, nlflags);
 succeeded:
 	return 0;