From 43d4ea6e6eb1d961fcea79befea1e0311fd95cea Mon Sep 17 00:00:00 2001 From: Matti Vaittinen Date: Wed, 16 Nov 2011 21:18:02 +0000 Subject: [PATCH] --- yaml --- r: 277594 b: refs/heads/master c: 14df015bb1708cd7ba1e5af11a1b0365b165a3ef h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/net/ipv6/ip6_fib.c | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/[refs] b/[refs] index 3a06cd080532..815aacfcfa24 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 8f5f69824fe221a36df781c2aee9fa1d74e89077 +refs/heads/master: 14df015bb1708cd7ba1e5af11a1b0365b165a3ef diff --git a/trunk/net/ipv6/ip6_fib.c b/trunk/net/ipv6/ip6_fib.c index e8a0fcf8850a..e7b26dccd2d3 100644 --- a/trunk/net/ipv6/ip6_fib.c +++ b/trunk/net/ipv6/ip6_fib.c @@ -449,9 +449,15 @@ static struct fib6_node * fib6_add_1(struct fib6_node *root, void *addr, */ if (plen < fn->fn_bit || !ipv6_prefix_equal(&key->addr, addr, fn->fn_bit)) { - if (!allow_create) + if (!allow_create) { + if (replace_required) { + printk(KERN_WARNING + "IPv6: Can't replace route, no match found\n"); + return ERR_PTR(-ENOENT); + } printk(KERN_WARNING "IPv6: NLM_F_CREATE should be set when creating new route\n"); + } goto insert_above; } @@ -482,7 +488,7 @@ static struct fib6_node * fib6_add_1(struct fib6_node *root, void *addr, fn = dir ? fn->right: fn->left; } while (fn); - if (replace_required && !allow_create) { + if (!allow_create) { /* We should not create new node because * NLM_F_REPLACE was specified without NLM_F_CREATE * I assume it is safe to require NLM_F_CREATE when @@ -492,16 +498,17 @@ static struct fib6_node * fib6_add_1(struct fib6_node *root, void *addr, * MUST be specified if new route is created. * That would keep IPv6 consistent with IPv4 */ - printk(KERN_WARNING - "IPv6: NLM_F_CREATE should be set when creating new route - ignoring request\n"); - return ERR_PTR(-ENOENT); + if (replace_required) { + printk(KERN_WARNING + "IPv6: Can't replace route, no match found\n"); + return ERR_PTR(-ENOENT); + } + printk(KERN_WARNING "IPv6: NLM_F_CREATE should be set when creating new route\n"); } /* * We walked to the bottom of tree. * Create new leaf node without children. */ - if (!allow_create) - printk(KERN_WARNING "IPv6: NLM_F_CREATE should be set when creating new route\n"); ln = node_alloc();