aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/vxlan.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/vxlan.c')
-rw-r--r--drivers/net/vxlan.c58
1 files changed, 34 insertions, 24 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index abb9cd2df9e9..ae7455da1687 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2899,30 +2899,6 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev,
2899 return 0; 2899 return 0;
2900} 2900}
2901 2901
2902struct net_device *vxlan_dev_create(struct net *net, const char *name,
2903 u8 name_assign_type, struct vxlan_config *conf)
2904{
2905 struct nlattr *tb[IFLA_MAX+1];
2906 struct net_device *dev;
2907 int err;
2908
2909 memset(&tb, 0, sizeof(tb));
2910
2911 dev = rtnl_create_link(net, name, name_assign_type,
2912 &vxlan_link_ops, tb);
2913 if (IS_ERR(dev))
2914 return dev;
2915
2916 err = vxlan_dev_configure(net, dev, conf);
2917 if (err < 0) {
2918 free_netdev(dev);
2919 return ERR_PTR(err);
2920 }
2921
2922 return dev;
2923}
2924EXPORT_SYMBOL_GPL(vxlan_dev_create);
2925
2926static int vxlan_newlink(struct net *src_net, struct net_device *dev, 2902static int vxlan_newlink(struct net *src_net, struct net_device *dev,
2927 struct nlattr *tb[], struct nlattr *data[]) 2903 struct nlattr *tb[], struct nlattr *data[])
2928{ 2904{
@@ -3215,6 +3191,40 @@ static struct rtnl_link_ops vxlan_link_ops __read_mostly = {
3215 .get_link_net = vxlan_get_link_net, 3191 .get_link_net = vxlan_get_link_net,
3216}; 3192};
3217 3193
3194struct net_device *vxlan_dev_create(struct net *net, const char *name,
3195 u8 name_assign_type,
3196 struct vxlan_config *conf)
3197{
3198 struct nlattr *tb[IFLA_MAX + 1];
3199 struct net_device *dev;
3200 int err;
3201
3202 memset(&tb, 0, sizeof(tb));
3203
3204 dev = rtnl_create_link(net, name, name_assign_type,
3205 &vxlan_link_ops, tb);
3206 if (IS_ERR(dev))
3207 return dev;
3208
3209 err = vxlan_dev_configure(net, dev, conf);
3210 if (err < 0) {
3211 free_netdev(dev);
3212 return ERR_PTR(err);
3213 }
3214
3215 err = rtnl_configure_link(dev, NULL);
3216 if (err < 0) {
3217 LIST_HEAD(list_kill);
3218
3219 vxlan_dellink(dev, &list_kill);
3220 unregister_netdevice_many(&list_kill);
3221 return ERR_PTR(err);
3222 }
3223
3224 return dev;
3225}
3226EXPORT_SYMBOL_GPL(vxlan_dev_create);
3227
3218static void vxlan_handle_lowerdev_unregister(struct vxlan_net *vn, 3228static void vxlan_handle_lowerdev_unregister(struct vxlan_net *vn,
3219 struct net_device *dev) 3229 struct net_device *dev)
3220{ 3230{