diff options
| -rw-r--r-- | net/batman-adv/hard-interface.c | 8 | ||||
| -rw-r--r-- | net/batman-adv/hard-interface.h | 13 | ||||
| -rw-r--r-- | net/batman-adv/sysfs.c | 6 |
3 files changed, 21 insertions, 6 deletions
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index da000e90f87f..74e3ec2fb116 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c | |||
| @@ -408,7 +408,8 @@ err: | |||
| 408 | return ret; | 408 | return ret; |
| 409 | } | 409 | } |
| 410 | 410 | ||
| 411 | void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface) | 411 | void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface, |
| 412 | enum batadv_hard_if_cleanup autodel) | ||
| 412 | { | 413 | { |
| 413 | struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface); | 414 | struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface); |
| 414 | struct batadv_hard_iface *primary_if = NULL; | 415 | struct batadv_hard_iface *primary_if = NULL; |
| @@ -446,7 +447,7 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface) | |||
| 446 | dev_put(hard_iface->soft_iface); | 447 | dev_put(hard_iface->soft_iface); |
| 447 | 448 | ||
| 448 | /* nobody uses this interface anymore */ | 449 | /* nobody uses this interface anymore */ |
| 449 | if (!bat_priv->num_ifaces) | 450 | if (!bat_priv->num_ifaces && autodel == BATADV_IF_CLEANUP_AUTO) |
| 450 | batadv_softif_destroy(hard_iface->soft_iface); | 451 | batadv_softif_destroy(hard_iface->soft_iface); |
| 451 | 452 | ||
| 452 | hard_iface->soft_iface = NULL; | 453 | hard_iface->soft_iface = NULL; |
| @@ -533,7 +534,8 @@ static void batadv_hardif_remove_interface(struct batadv_hard_iface *hard_iface) | |||
| 533 | 534 | ||
| 534 | /* first deactivate interface */ | 535 | /* first deactivate interface */ |
| 535 | if (hard_iface->if_status != BATADV_IF_NOT_IN_USE) | 536 | if (hard_iface->if_status != BATADV_IF_NOT_IN_USE) |
| 536 | batadv_hardif_disable_interface(hard_iface); | 537 | batadv_hardif_disable_interface(hard_iface, |
| 538 | BATADV_IF_CLEANUP_AUTO); | ||
| 537 | 539 | ||
| 538 | if (hard_iface->if_status != BATADV_IF_NOT_IN_USE) | 540 | if (hard_iface->if_status != BATADV_IF_NOT_IN_USE) |
| 539 | return; | 541 | return; |
diff --git a/net/batman-adv/hard-interface.h b/net/batman-adv/hard-interface.h index 308437d52e22..49892881a7c5 100644 --- a/net/batman-adv/hard-interface.h +++ b/net/batman-adv/hard-interface.h | |||
| @@ -29,13 +29,24 @@ enum batadv_hard_if_state { | |||
| 29 | BATADV_IF_I_WANT_YOU, | 29 | BATADV_IF_I_WANT_YOU, |
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | /** | ||
| 33 | * enum batadv_hard_if_cleanup - Cleanup modi for soft_iface after slave removal | ||
| 34 | * @BATADV_IF_CLEANUP_KEEP: Don't automatically delete soft-interface | ||
| 35 | * @BATADV_IF_CLEANUP_AUTO: Delete soft-interface after last slave was removed | ||
| 36 | */ | ||
| 37 | enum batadv_hard_if_cleanup { | ||
| 38 | BATADV_IF_CLEANUP_KEEP, | ||
| 39 | BATADV_IF_CLEANUP_AUTO, | ||
| 40 | }; | ||
| 41 | |||
| 32 | extern struct notifier_block batadv_hard_if_notifier; | 42 | extern struct notifier_block batadv_hard_if_notifier; |
| 33 | 43 | ||
| 34 | struct batadv_hard_iface* | 44 | struct batadv_hard_iface* |
| 35 | batadv_hardif_get_by_netdev(const struct net_device *net_dev); | 45 | batadv_hardif_get_by_netdev(const struct net_device *net_dev); |
| 36 | int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface, | 46 | int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface, |
| 37 | const char *iface_name); | 47 | const char *iface_name); |
| 38 | void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface); | 48 | void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface, |
| 49 | enum batadv_hard_if_cleanup autodel); | ||
| 39 | void batadv_hardif_remove_interfaces(void); | 50 | void batadv_hardif_remove_interfaces(void); |
| 40 | int batadv_hardif_min_mtu(struct net_device *soft_iface); | 51 | int batadv_hardif_min_mtu(struct net_device *soft_iface); |
| 41 | void batadv_update_min_mtu(struct net_device *soft_iface); | 52 | void batadv_update_min_mtu(struct net_device *soft_iface); |
diff --git a/net/batman-adv/sysfs.c b/net/batman-adv/sysfs.c index ce39f62f751e..15a22efa9a67 100644 --- a/net/batman-adv/sysfs.c +++ b/net/batman-adv/sysfs.c | |||
| @@ -588,13 +588,15 @@ static ssize_t batadv_store_mesh_iface(struct kobject *kobj, | |||
| 588 | } | 588 | } |
| 589 | 589 | ||
| 590 | if (status_tmp == BATADV_IF_NOT_IN_USE) { | 590 | if (status_tmp == BATADV_IF_NOT_IN_USE) { |
| 591 | batadv_hardif_disable_interface(hard_iface); | 591 | batadv_hardif_disable_interface(hard_iface, |
| 592 | BATADV_IF_CLEANUP_AUTO); | ||
| 592 | goto unlock; | 593 | goto unlock; |
| 593 | } | 594 | } |
| 594 | 595 | ||
| 595 | /* if the interface already is in use */ | 596 | /* if the interface already is in use */ |
| 596 | if (hard_iface->if_status != BATADV_IF_NOT_IN_USE) | 597 | if (hard_iface->if_status != BATADV_IF_NOT_IN_USE) |
| 597 | batadv_hardif_disable_interface(hard_iface); | 598 | batadv_hardif_disable_interface(hard_iface, |
| 599 | BATADV_IF_CLEANUP_AUTO); | ||
| 598 | 600 | ||
| 599 | ret = batadv_hardif_enable_interface(hard_iface, buff); | 601 | ret = batadv_hardif_enable_interface(hard_iface, buff); |
| 600 | 602 | ||
