Browse Source

net: hsr/prp: Remove self node from node table list for query

Node Table list should store remote node information. Even
though driver stores also self node for internal implementation,
it should be excluded when querying for node list.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Murali Karicheri 7 years ago
parent
commit
7fe1053c1e
2 changed files with 12 additions and 8 deletions
  1. 6 4
      net/hsr-prp/hsr_netlink.c
  2. 6 4
      net/hsr-prp/prp_netlink.c

+ 6 - 4
net/hsr-prp/hsr_netlink.c

@@ -407,10 +407,12 @@ static int hsr_get_node_list(struct sk_buff *skb_in, struct genl_info *info)
 	rcu_read_lock();
 	pos = hsr_prp_get_next_node(priv, NULL, addr);
 	while (pos) {
-		res = nla_put(skb_out, HSR_A_NODE_ADDR, ETH_ALEN, addr);
-		if (res < 0) {
-			rcu_read_unlock();
-			goto nla_put_failure;
+		if (!hsr_prp_addr_is_self(priv, addr)) {
+			res = nla_put(skb_out, HSR_A_NODE_ADDR, ETH_ALEN, addr);
+			if (res < 0) {
+				rcu_read_unlock();
+				goto nla_put_failure;
+			}
 		}
 		pos = hsr_prp_get_next_node(priv, pos, addr);
 	}

+ 6 - 4
net/hsr-prp/prp_netlink.c

@@ -358,10 +358,12 @@ static int prp_get_node_list(struct sk_buff *skb_in, struct genl_info *info)
 	rcu_read_lock();
 	pos = hsr_prp_get_next_node(priv, NULL, addr);
 	while (pos) {
-		res = nla_put(skb_out, PRP_A_NODE_ADDR, ETH_ALEN, addr);
-		if (res < 0) {
-			rcu_read_unlock();
-			goto nla_put_failure;
+		if (!hsr_prp_addr_is_self(priv, addr)) {
+			res = nla_put(skb_out, PRP_A_NODE_ADDR, ETH_ALEN, addr);
+			if (res < 0) {
+				rcu_read_unlock();
+				goto nla_put_failure;
+			}
 		}
 		pos = hsr_prp_get_next_node(priv, pos, addr);
 	}