Browse Source

device_addr: record address index as in the blob

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Acked-by: Hans Dedecker <dedeckeh@gmail.com>
Yousong Zhou 3 years ago
parent
commit
3d7bf6043b
2 changed files with 3 additions and 0 deletions
  1. 1 0
      interface-ip.h
  2. 2 0
      proto.c

+ 1 - 0
interface-ip.h

@@ -127,6 +127,7 @@ struct device_addr {
 	struct vlist_node node;
 	bool enabled;
 	bool failed;
+	int index;
 	unsigned int policy_table;
 
 	struct device_route subnet;

+ 2 - 0
proto.c

@@ -172,6 +172,7 @@ parse_static_address_option(struct interface *iface, struct blob_attr *attr,
 			interface_add_error(iface, "proto", "INVALID_ADDRESS", &str, 1);
 			return -1;
 		}
+		addr->index = n_addr;
 		n_addr++;
 		vlist_add(&iface->proto_ip.addr, &addr->node, &addr->flags);
 	}
@@ -272,6 +273,7 @@ parse_address_list(struct interface *iface, struct blob_attr *attr, bool v6,
 		if (!addr)
 			return -1;
 
+		addr->index = n_addr;
 		n_addr++;
 		vlist_add(&iface->proto_ip.addr, &addr->node, &addr->flags);
 	}