diff options
Diffstat (limited to 'net/ipv4/fib_frontend.c')
-rw-r--r-- | net/ipv4/fib_frontend.c | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 8732cc7920ed..68c93d1bb03a 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -148,7 +148,7 @@ static void fib_flush(struct net *net) | |||
148 | } | 148 | } |
149 | 149 | ||
150 | if (flushed) | 150 | if (flushed) |
151 | rt_cache_flush(net, -1); | 151 | rt_cache_flush(net); |
152 | } | 152 | } |
153 | 153 | ||
154 | /* | 154 | /* |
@@ -218,7 +218,7 @@ __be32 fib_compute_spec_dst(struct sk_buff *skb) | |||
218 | scope = RT_SCOPE_UNIVERSE; | 218 | scope = RT_SCOPE_UNIVERSE; |
219 | if (!ipv4_is_zeronet(ip_hdr(skb)->saddr)) { | 219 | if (!ipv4_is_zeronet(ip_hdr(skb)->saddr)) { |
220 | fl4.flowi4_oif = 0; | 220 | fl4.flowi4_oif = 0; |
221 | fl4.flowi4_iif = net->loopback_dev->ifindex; | 221 | fl4.flowi4_iif = LOOPBACK_IFINDEX; |
222 | fl4.daddr = ip_hdr(skb)->saddr; | 222 | fl4.daddr = ip_hdr(skb)->saddr; |
223 | fl4.saddr = 0; | 223 | fl4.saddr = 0; |
224 | fl4.flowi4_tos = RT_TOS(ip_hdr(skb)->tos); | 224 | fl4.flowi4_tos = RT_TOS(ip_hdr(skb)->tos); |
@@ -557,7 +557,7 @@ static int rtm_to_fib_config(struct net *net, struct sk_buff *skb, | |||
557 | cfg->fc_flags = rtm->rtm_flags; | 557 | cfg->fc_flags = rtm->rtm_flags; |
558 | cfg->fc_nlflags = nlh->nlmsg_flags; | 558 | cfg->fc_nlflags = nlh->nlmsg_flags; |
559 | 559 | ||
560 | cfg->fc_nlinfo.pid = NETLINK_CB(skb).pid; | 560 | cfg->fc_nlinfo.portid = NETLINK_CB(skb).portid; |
561 | cfg->fc_nlinfo.nlh = nlh; | 561 | cfg->fc_nlinfo.nlh = nlh; |
562 | cfg->fc_nlinfo.nl_net = net; | 562 | cfg->fc_nlinfo.nl_net = net; |
563 | 563 | ||
@@ -955,7 +955,7 @@ static void nl_fib_input(struct sk_buff *skb) | |||
955 | struct fib_result_nl *frn; | 955 | struct fib_result_nl *frn; |
956 | struct nlmsghdr *nlh; | 956 | struct nlmsghdr *nlh; |
957 | struct fib_table *tb; | 957 | struct fib_table *tb; |
958 | u32 pid; | 958 | u32 portid; |
959 | 959 | ||
960 | net = sock_net(skb->sk); | 960 | net = sock_net(skb->sk); |
961 | nlh = nlmsg_hdr(skb); | 961 | nlh = nlmsg_hdr(skb); |
@@ -973,10 +973,10 @@ static void nl_fib_input(struct sk_buff *skb) | |||
973 | 973 | ||
974 | nl_fib_lookup(frn, tb); | 974 | nl_fib_lookup(frn, tb); |
975 | 975 | ||
976 | pid = NETLINK_CB(skb).pid; /* pid of sending process */ | 976 | portid = NETLINK_CB(skb).portid; /* pid of sending process */ |
977 | NETLINK_CB(skb).pid = 0; /* from kernel */ | 977 | NETLINK_CB(skb).portid = 0; /* from kernel */ |
978 | NETLINK_CB(skb).dst_group = 0; /* unicast */ | 978 | NETLINK_CB(skb).dst_group = 0; /* unicast */ |
979 | netlink_unicast(net->ipv4.fibnl, skb, pid, MSG_DONTWAIT); | 979 | netlink_unicast(net->ipv4.fibnl, skb, portid, MSG_DONTWAIT); |
980 | } | 980 | } |
981 | 981 | ||
982 | static int __net_init nl_fib_lookup_init(struct net *net) | 982 | static int __net_init nl_fib_lookup_init(struct net *net) |
@@ -986,7 +986,7 @@ static int __net_init nl_fib_lookup_init(struct net *net) | |||
986 | .input = nl_fib_input, | 986 | .input = nl_fib_input, |
987 | }; | 987 | }; |
988 | 988 | ||
989 | sk = netlink_kernel_create(net, NETLINK_FIB_LOOKUP, THIS_MODULE, &cfg); | 989 | sk = netlink_kernel_create(net, NETLINK_FIB_LOOKUP, &cfg); |
990 | if (sk == NULL) | 990 | if (sk == NULL) |
991 | return -EAFNOSUPPORT; | 991 | return -EAFNOSUPPORT; |
992 | net->ipv4.fibnl = sk; | 992 | net->ipv4.fibnl = sk; |
@@ -999,11 +999,11 @@ static void nl_fib_lookup_exit(struct net *net) | |||
999 | net->ipv4.fibnl = NULL; | 999 | net->ipv4.fibnl = NULL; |
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | static void fib_disable_ip(struct net_device *dev, int force, int delay) | 1002 | static void fib_disable_ip(struct net_device *dev, int force) |
1003 | { | 1003 | { |
1004 | if (fib_sync_down_dev(dev, force)) | 1004 | if (fib_sync_down_dev(dev, force)) |
1005 | fib_flush(dev_net(dev)); | 1005 | fib_flush(dev_net(dev)); |
1006 | rt_cache_flush(dev_net(dev), delay); | 1006 | rt_cache_flush(dev_net(dev)); |
1007 | arp_ifdown(dev); | 1007 | arp_ifdown(dev); |
1008 | } | 1008 | } |
1009 | 1009 | ||
@@ -1020,7 +1020,7 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, | |||
1020 | fib_sync_up(dev); | 1020 | fib_sync_up(dev); |
1021 | #endif | 1021 | #endif |
1022 | atomic_inc(&net->ipv4.dev_addr_genid); | 1022 | atomic_inc(&net->ipv4.dev_addr_genid); |
1023 | rt_cache_flush(dev_net(dev), -1); | 1023 | rt_cache_flush(dev_net(dev)); |
1024 | break; | 1024 | break; |
1025 | case NETDEV_DOWN: | 1025 | case NETDEV_DOWN: |
1026 | fib_del_ifaddr(ifa, NULL); | 1026 | fib_del_ifaddr(ifa, NULL); |
@@ -1029,9 +1029,9 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, | |||
1029 | /* Last address was deleted from this interface. | 1029 | /* Last address was deleted from this interface. |
1030 | * Disable IP. | 1030 | * Disable IP. |
1031 | */ | 1031 | */ |
1032 | fib_disable_ip(dev, 1, 0); | 1032 | fib_disable_ip(dev, 1); |
1033 | } else { | 1033 | } else { |
1034 | rt_cache_flush(dev_net(dev), -1); | 1034 | rt_cache_flush(dev_net(dev)); |
1035 | } | 1035 | } |
1036 | break; | 1036 | break; |
1037 | } | 1037 | } |
@@ -1041,16 +1041,16 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, | |||
1041 | static int fib_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) | 1041 | static int fib_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) |
1042 | { | 1042 | { |
1043 | struct net_device *dev = ptr; | 1043 | struct net_device *dev = ptr; |
1044 | struct in_device *in_dev = __in_dev_get_rtnl(dev); | 1044 | struct in_device *in_dev; |
1045 | struct net *net = dev_net(dev); | 1045 | struct net *net = dev_net(dev); |
1046 | 1046 | ||
1047 | if (event == NETDEV_UNREGISTER) { | 1047 | if (event == NETDEV_UNREGISTER) { |
1048 | fib_disable_ip(dev, 2, -1); | 1048 | fib_disable_ip(dev, 2); |
1049 | rt_flush_dev(dev); | ||
1049 | return NOTIFY_DONE; | 1050 | return NOTIFY_DONE; |
1050 | } | 1051 | } |
1051 | 1052 | ||
1052 | if (!in_dev) | 1053 | in_dev = __in_dev_get_rtnl(dev); |
1053 | return NOTIFY_DONE; | ||
1054 | 1054 | ||
1055 | switch (event) { | 1055 | switch (event) { |
1056 | case NETDEV_UP: | 1056 | case NETDEV_UP: |
@@ -1061,16 +1061,14 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo | |||
1061 | fib_sync_up(dev); | 1061 | fib_sync_up(dev); |
1062 | #endif | 1062 | #endif |
1063 | atomic_inc(&net->ipv4.dev_addr_genid); | 1063 | atomic_inc(&net->ipv4.dev_addr_genid); |
1064 | rt_cache_flush(dev_net(dev), -1); | 1064 | rt_cache_flush(net); |
1065 | break; | 1065 | break; |
1066 | case NETDEV_DOWN: | 1066 | case NETDEV_DOWN: |
1067 | fib_disable_ip(dev, 0, 0); | 1067 | fib_disable_ip(dev, 0); |
1068 | break; | 1068 | break; |
1069 | case NETDEV_CHANGEMTU: | 1069 | case NETDEV_CHANGEMTU: |
1070 | case NETDEV_CHANGE: | 1070 | case NETDEV_CHANGE: |
1071 | rt_cache_flush(dev_net(dev), 0); | 1071 | rt_cache_flush(net); |
1072 | break; | ||
1073 | case NETDEV_UNREGISTER_BATCH: | ||
1074 | break; | 1072 | break; |
1075 | } | 1073 | } |
1076 | return NOTIFY_DONE; | 1074 | return NOTIFY_DONE; |