Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'batadv-net-for-davem-20180717' of git://git.open-mesh.org/linux-merge

Simon Wunderlich says:

====================
Here are some batman-adv fixes:

- Fix gateway refcounting in BATMAN IV and V, by Sven Eckelmann (2 patches)

- Fix debugfs paths when renaming interfaces, by Sven Eckelmann (2 patches)

- Fix TT flag issues, by Linus Luessing (2 patches)
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+93 -10
+3 -1
net/batman-adv/bat_iv_ogm.c
··· 2732 2732 { 2733 2733 struct batadv_neigh_ifinfo *router_ifinfo = NULL; 2734 2734 struct batadv_neigh_node *router; 2735 - struct batadv_gw_node *curr_gw; 2735 + struct batadv_gw_node *curr_gw = NULL; 2736 2736 int ret = 0; 2737 2737 void *hdr; 2738 2738 ··· 2780 2780 ret = 0; 2781 2781 2782 2782 out: 2783 + if (curr_gw) 2784 + batadv_gw_node_put(curr_gw); 2783 2785 if (router_ifinfo) 2784 2786 batadv_neigh_ifinfo_put(router_ifinfo); 2785 2787 if (router)
+3 -1
net/batman-adv/bat_v.c
··· 927 927 { 928 928 struct batadv_neigh_ifinfo *router_ifinfo = NULL; 929 929 struct batadv_neigh_node *router; 930 - struct batadv_gw_node *curr_gw; 930 + struct batadv_gw_node *curr_gw = NULL; 931 931 int ret = 0; 932 932 void *hdr; 933 933 ··· 995 995 ret = 0; 996 996 997 997 out: 998 + if (curr_gw) 999 + batadv_gw_node_put(curr_gw); 998 1000 if (router_ifinfo) 999 1001 batadv_neigh_ifinfo_put(router_ifinfo); 1000 1002 if (router)
+40
net/batman-adv/debugfs.c
··· 19 19 #include "debugfs.h" 20 20 #include "main.h" 21 21 22 + #include <linux/dcache.h> 22 23 #include <linux/debugfs.h> 23 24 #include <linux/err.h> 24 25 #include <linux/errno.h> ··· 345 344 } 346 345 347 346 /** 347 + * batadv_debugfs_rename_hardif() - Fix debugfs path for renamed hardif 348 + * @hard_iface: hard interface which was renamed 349 + */ 350 + void batadv_debugfs_rename_hardif(struct batadv_hard_iface *hard_iface) 351 + { 352 + const char *name = hard_iface->net_dev->name; 353 + struct dentry *dir; 354 + struct dentry *d; 355 + 356 + dir = hard_iface->debug_dir; 357 + if (!dir) 358 + return; 359 + 360 + d = debugfs_rename(dir->d_parent, dir, dir->d_parent, name); 361 + if (!d) 362 + pr_err("Can't rename debugfs dir to %s\n", name); 363 + } 364 + 365 + /** 348 366 * batadv_debugfs_del_hardif() - delete the base directory for a hard interface 349 367 * in debugfs. 350 368 * @hard_iface: hard interface which is deleted. ··· 431 411 bat_priv->debug_dir = NULL; 432 412 out: 433 413 return -ENOMEM; 414 + } 415 + 416 + /** 417 + * batadv_debugfs_rename_meshif() - Fix debugfs path for renamed softif 418 + * @dev: net_device which was renamed 419 + */ 420 + void batadv_debugfs_rename_meshif(struct net_device *dev) 421 + { 422 + struct batadv_priv *bat_priv = netdev_priv(dev); 423 + const char *name = dev->name; 424 + struct dentry *dir; 425 + struct dentry *d; 426 + 427 + dir = bat_priv->debug_dir; 428 + if (!dir) 429 + return; 430 + 431 + d = debugfs_rename(dir->d_parent, dir, dir->d_parent, name); 432 + if (!d) 433 + pr_err("Can't rename debugfs dir to %s\n", name); 434 434 } 435 435 436 436 /**
+11
net/batman-adv/debugfs.h
··· 30 30 void batadv_debugfs_init(void); 31 31 void batadv_debugfs_destroy(void); 32 32 int batadv_debugfs_add_meshif(struct net_device *dev); 33 + void batadv_debugfs_rename_meshif(struct net_device *dev); 33 34 void batadv_debugfs_del_meshif(struct net_device *dev); 34 35 int batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface); 36 + void batadv_debugfs_rename_hardif(struct batadv_hard_iface *hard_iface); 35 37 void batadv_debugfs_del_hardif(struct batadv_hard_iface *hard_iface); 36 38 37 39 #else ··· 51 49 return 0; 52 50 } 53 51 52 + static inline void batadv_debugfs_rename_meshif(struct net_device *dev) 53 + { 54 + } 55 + 54 56 static inline void batadv_debugfs_del_meshif(struct net_device *dev) 55 57 { 56 58 } ··· 63 57 int batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface) 64 58 { 65 59 return 0; 60 + } 61 + 62 + static inline 63 + void batadv_debugfs_rename_hardif(struct batadv_hard_iface *hard_iface) 64 + { 66 65 } 67 66 68 67 static inline
+31 -6
net/batman-adv/hard-interface.c
··· 989 989 rtnl_unlock(); 990 990 } 991 991 992 + /** 993 + * batadv_hard_if_event_softif() - Handle events for soft interfaces 994 + * @event: NETDEV_* event to handle 995 + * @net_dev: net_device which generated an event 996 + * 997 + * Return: NOTIFY_* result 998 + */ 999 + static int batadv_hard_if_event_softif(unsigned long event, 1000 + struct net_device *net_dev) 1001 + { 1002 + struct batadv_priv *bat_priv; 1003 + 1004 + switch (event) { 1005 + case NETDEV_REGISTER: 1006 + batadv_sysfs_add_meshif(net_dev); 1007 + bat_priv = netdev_priv(net_dev); 1008 + batadv_softif_create_vlan(bat_priv, BATADV_NO_FLAGS); 1009 + break; 1010 + case NETDEV_CHANGENAME: 1011 + batadv_debugfs_rename_meshif(net_dev); 1012 + break; 1013 + } 1014 + 1015 + return NOTIFY_DONE; 1016 + } 1017 + 992 1018 static int batadv_hard_if_event(struct notifier_block *this, 993 1019 unsigned long event, void *ptr) 994 1020 { ··· 1023 997 struct batadv_hard_iface *primary_if = NULL; 1024 998 struct batadv_priv *bat_priv; 1025 999 1026 - if (batadv_softif_is_valid(net_dev) && event == NETDEV_REGISTER) { 1027 - batadv_sysfs_add_meshif(net_dev); 1028 - bat_priv = netdev_priv(net_dev); 1029 - batadv_softif_create_vlan(bat_priv, BATADV_NO_FLAGS); 1030 - return NOTIFY_DONE; 1031 - } 1000 + if (batadv_softif_is_valid(net_dev)) 1001 + return batadv_hard_if_event_softif(event, net_dev); 1032 1002 1033 1003 hard_iface = batadv_hardif_get_by_netdev(net_dev); 1034 1004 if (!hard_iface && (event == NETDEV_REGISTER || ··· 1072 1050 hard_iface->wifi_flags = batadv_wifi_flags_evaluate(net_dev); 1073 1051 if (batadv_is_wifi_hardif(hard_iface)) 1074 1052 hard_iface->num_bcasts = BATADV_NUM_BCASTS_WIRELESS; 1053 + break; 1054 + case NETDEV_CHANGENAME: 1055 + batadv_debugfs_rename_hardif(hard_iface); 1075 1056 break; 1076 1057 default: 1077 1058 break;
+5 -2
net/batman-adv/translation-table.c
··· 1705 1705 ether_addr_copy(common->addr, tt_addr); 1706 1706 common->vid = vid; 1707 1707 1708 - common->flags = flags; 1708 + if (!is_multicast_ether_addr(common->addr)) 1709 + common->flags = flags & (~BATADV_TT_SYNC_MASK); 1710 + 1709 1711 tt_global_entry->roam_at = 0; 1710 1712 /* node must store current time in case of roaming. This is 1711 1713 * needed to purge this entry out on timeout (if nobody claims ··· 1770 1768 * TT_CLIENT_TEMP, therefore they have to be copied in the 1771 1769 * client entry 1772 1770 */ 1773 - common->flags |= flags & (~BATADV_TT_SYNC_MASK); 1771 + if (!is_multicast_ether_addr(common->addr)) 1772 + common->flags |= flags & (~BATADV_TT_SYNC_MASK); 1774 1773 1775 1774 /* If there is the BATADV_TT_CLIENT_ROAM flag set, there is only 1776 1775 * one originator left in the list and we previously received a