diff options
author | Matti Vaittinen <matti.vaittinen@nsn.com> | 2011-11-13 19:14:49 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-11-14 14:35:33 -0500 |
commit | d71314b4ac88637f9ac2770a9f635babdf6f2ff9 (patch) | |
tree | d783319152ab7107b680c0654b2bd8dad2173d23 /net/ipv6/route.c | |
parent | abbd00b82a2771b0460ba2cffdb1343aa827ccde (diff) |
IPv6 routing, NLM_F_* flag support: warn if new route is created without NLM_F_CREATE
The support for NLM_F_* flags at IPv6 routing requests.
Warn if NLM_F_CREATE flag is not defined for RTM_NEWROUTE request,
creating new table. Later NLM_F_CREATE may be required for
new route creation.
Patch created against linux-3.2-rc1
Signed-off-by: Matti Vaittinen <Mazziesaccount@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r-- | net/ipv6/route.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 8473016bba4a..05c89be04c9f 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -1230,9 +1230,18 @@ int ip6_route_add(struct fib6_config *cfg) | |||
1230 | if (cfg->fc_metric == 0) | 1230 | if (cfg->fc_metric == 0) |
1231 | cfg->fc_metric = IP6_RT_PRIO_USER; | 1231 | cfg->fc_metric = IP6_RT_PRIO_USER; |
1232 | 1232 | ||
1233 | table = fib6_new_table(net, cfg->fc_table); | 1233 | err = -ENOBUFS; |
1234 | if (NULL != cfg->fc_nlinfo.nlh && | ||
1235 | !(cfg->fc_nlinfo.nlh->nlmsg_flags&NLM_F_CREATE)) { | ||
1236 | table = fib6_get_table(net, cfg->fc_table); | ||
1237 | if (table == NULL) { | ||
1238 | printk(KERN_WARNING "IPv6: NLM_F_CREATE should be specified when creating new route\n"); | ||
1239 | table = fib6_new_table(net, cfg->fc_table); | ||
1240 | } | ||
1241 | } else { | ||
1242 | table = fib6_new_table(net, cfg->fc_table); | ||
1243 | } | ||
1234 | if (table == NULL) { | 1244 | if (table == NULL) { |
1235 | err = -ENOBUFS; | ||
1236 | goto out; | 1245 | goto out; |
1237 | } | 1246 | } |
1238 | 1247 | ||