aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-11-27 20:21:48 -0500
committerDavid S. Miller <davem@davemloft.net>2016-11-27 20:21:48 -0500
commit8eb4adf60b8a2e0857643910c01aac98fe613466 (patch)
tree9ceb2f84e28ab1c94156a88ecc1dbbbef7374c98 /net/ipv6
parente824265d632629c3d2583d86b8a816e886a5136c (diff)
parent6b226487815574193c1da864f2eac274781a2b0c (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec
Steffen Klassert says: ==================== pull request (net): ipsec 2016-11-25 1) Fix a refcount leak in vti6. From Nicolas Dichtel. 2) Fix a wrong if statement in xfrm_sk_policy_lookup. From Florian Westphal. 3) The flowcache watermarks are per cpu. Take this into account when comparing to the threshold where we refusing new allocations. From Miroslav Urbanek. Please pull or let me know if there are problems. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/ip6_vti.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index 8a02ca8a11af..c299c1e2bbf0 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -1138,6 +1138,33 @@ static struct xfrm6_protocol vti_ipcomp6_protocol __read_mostly = {
1138 .priority = 100, 1138 .priority = 100,
1139}; 1139};
1140 1140
1141static bool is_vti6_tunnel(const struct net_device *dev)
1142{
1143 return dev->netdev_ops == &vti6_netdev_ops;
1144}
1145
1146static int vti6_device_event(struct notifier_block *unused,
1147 unsigned long event, void *ptr)
1148{
1149 struct net_device *dev = netdev_notifier_info_to_dev(ptr);
1150 struct ip6_tnl *t = netdev_priv(dev);
1151
1152 if (!is_vti6_tunnel(dev))
1153 return NOTIFY_DONE;
1154
1155 switch (event) {
1156 case NETDEV_DOWN:
1157 if (!net_eq(t->net, dev_net(dev)))
1158 xfrm_garbage_collect(t->net);
1159 break;
1160 }
1161 return NOTIFY_DONE;
1162}
1163
1164static struct notifier_block vti6_notifier_block __read_mostly = {
1165 .notifier_call = vti6_device_event,
1166};
1167
1141/** 1168/**
1142 * vti6_tunnel_init - register protocol and reserve needed resources 1169 * vti6_tunnel_init - register protocol and reserve needed resources
1143 * 1170 *
@@ -1148,6 +1175,8 @@ static int __init vti6_tunnel_init(void)
1148 const char *msg; 1175 const char *msg;
1149 int err; 1176 int err;
1150 1177
1178 register_netdevice_notifier(&vti6_notifier_block);
1179
1151 msg = "tunnel device"; 1180 msg = "tunnel device";
1152 err = register_pernet_device(&vti6_net_ops); 1181 err = register_pernet_device(&vti6_net_ops);
1153 if (err < 0) 1182 if (err < 0)
@@ -1180,6 +1209,7 @@ xfrm_proto_ah_failed:
1180xfrm_proto_esp_failed: 1209xfrm_proto_esp_failed:
1181 unregister_pernet_device(&vti6_net_ops); 1210 unregister_pernet_device(&vti6_net_ops);
1182pernet_dev_failed: 1211pernet_dev_failed:
1212 unregister_netdevice_notifier(&vti6_notifier_block);
1183 pr_err("vti6 init: failed to register %s\n", msg); 1213 pr_err("vti6 init: failed to register %s\n", msg);
1184 return err; 1214 return err;
1185} 1215}
@@ -1194,6 +1224,7 @@ static void __exit vti6_tunnel_cleanup(void)
1194 xfrm6_protocol_deregister(&vti_ah6_protocol, IPPROTO_AH); 1224 xfrm6_protocol_deregister(&vti_ah6_protocol, IPPROTO_AH);
1195 xfrm6_protocol_deregister(&vti_esp6_protocol, IPPROTO_ESP); 1225 xfrm6_protocol_deregister(&vti_esp6_protocol, IPPROTO_ESP);
1196 unregister_pernet_device(&vti6_net_ops); 1226 unregister_pernet_device(&vti6_net_ops);
1227 unregister_netdevice_notifier(&vti6_notifier_block);
1197} 1228}
1198 1229
1199module_init(vti6_tunnel_init); 1230module_init(vti6_tunnel_init);