Commit b8f558313506b5bc435f2e031f3bec4b1725098e

Authored by Milan Kocian
Committed by David S. Miller
1 parent 8a903be129

[RTNETLINK]: Fix sending netlink message when replace route.

When you replace route via ip r r command the netlink multicast message is
not send.  This patch corrects it.  NL message is sent with NLM_F_REPLACE
flag.

Addresses http://bugzilla.kernel.org/show_bug.cgi?id=8320

Signed-off-by: Milan Kocian <milon@wq.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 4 changed files with 13 additions and 7 deletions Side-by-side Diff

... ... @@ -456,6 +456,8 @@
456 456 fib_release_info(fi_drop);
457 457 if (state & FA_S_ACCESSED)
458 458 rt_cache_flush(-1);
  459 + rtmsg_fib(RTM_NEWROUTE, key, fa, cfg->fc_dst_len, tb->tb_id,
  460 + &cfg->fc_nlinfo, NLM_F_REPLACE);
459 461 return 0;
460 462 }
461 463  
... ... @@ -523,7 +525,7 @@
523 525 rt_cache_flush(-1);
524 526  
525 527 rtmsg_fib(RTM_NEWROUTE, key, new_fa, cfg->fc_dst_len, tb->tb_id,
526   - &cfg->fc_nlinfo);
  528 + &cfg->fc_nlinfo, 0);
527 529 return 0;
528 530  
529 531 out_free_new_fa:
... ... @@ -589,7 +591,7 @@
589 591  
590 592 fa = fa_to_delete;
591 593 rtmsg_fib(RTM_DELROUTE, key, fa, cfg->fc_dst_len,
592   - tb->tb_id, &cfg->fc_nlinfo);
  594 + tb->tb_id, &cfg->fc_nlinfo, 0);
593 595  
594 596 kill_fn = 0;
595 597 write_lock_bh(&fib_hash_lock);
net/ipv4/fib_lookup.h
... ... @@ -30,7 +30,8 @@
30 30 int dst_len, u8 tos, struct fib_info *fi,
31 31 unsigned int);
32 32 extern void rtmsg_fib(int event, __be32 key, struct fib_alias *fa,
33   - int dst_len, u32 tb_id, struct nl_info *info);
  33 + int dst_len, u32 tb_id, struct nl_info *info,
  34 + unsigned int nlm_flags);
34 35 extern struct fib_alias *fib_find_alias(struct list_head *fah,
35 36 u8 tos, u32 prio);
36 37 extern int fib_detect_death(struct fib_info *fi, int order,
net/ipv4/fib_semantics.c
... ... @@ -301,7 +301,8 @@
301 301 }
302 302  
303 303 void rtmsg_fib(int event, __be32 key, struct fib_alias *fa,
304   - int dst_len, u32 tb_id, struct nl_info *info)
  304 + int dst_len, u32 tb_id, struct nl_info *info,
  305 + unsigned int nlm_flags)
305 306 {
306 307 struct sk_buff *skb;
307 308 u32 seq = info->nlh ? info->nlh->nlmsg_seq : 0;
... ... @@ -313,7 +314,7 @@
313 314  
314 315 err = fib_dump_info(skb, info->pid, seq, event, tb_id,
315 316 fa->fa_type, fa->fa_scope, key, dst_len,
316   - fa->fa_tos, fa->fa_info, 0);
  317 + fa->fa_tos, fa->fa_info, nlm_flags);
317 318 if (err < 0) {
318 319 /* -EMSGSIZE implies BUG in fib_nlmsg_size() */
319 320 WARN_ON(err == -EMSGSIZE);
... ... @@ -1226,6 +1226,8 @@
1226 1226 fib_release_info(fi_drop);
1227 1227 if (state & FA_S_ACCESSED)
1228 1228 rt_cache_flush(-1);
  1229 + rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen,
  1230 + tb->tb_id, &cfg->fc_nlinfo, NLM_F_REPLACE);
1229 1231  
1230 1232 goto succeeded;
1231 1233 }
... ... @@ -1278,7 +1280,7 @@
1278 1280  
1279 1281 rt_cache_flush(-1);
1280 1282 rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, tb->tb_id,
1281   - &cfg->fc_nlinfo);
  1283 + &cfg->fc_nlinfo, 0);
1282 1284 succeeded:
1283 1285 return 0;
1284 1286  
... ... @@ -1624,7 +1626,7 @@
1624 1626  
1625 1627 fa = fa_to_delete;
1626 1628 rtmsg_fib(RTM_DELROUTE, htonl(key), fa, plen, tb->tb_id,
1627   - &cfg->fc_nlinfo);
  1629 + &cfg->fc_nlinfo, 0);
1628 1630  
1629 1631 l = fib_find_node(t, key);
1630 1632 li = find_leaf_info(l, plen);