8 #include "interface-ip.h"
14 interface_update_proto_addr(struct vlist_tree *tree,
15 struct vlist_node *node_new,
16 struct vlist_node *node_old)
18 struct interface *iface;
20 struct device_addr *addr;
22 iface = container_of(tree, struct interface, proto_addr);
23 dev = iface->l3_dev->dev;
26 addr = container_of(node_old, struct device_addr, node);
27 if (!(addr->flags & DEVADDR_EXTERNAL))
28 system_del_address(dev, addr);
33 addr = container_of(node_new, struct device_addr, node);
34 if (!(addr->flags & DEVADDR_EXTERNAL))
35 system_add_address(dev, addr);
40 interface_update_proto_route(struct vlist_tree *tree,
41 struct vlist_node *node_new,
42 struct vlist_node *node_old)
44 struct interface *iface;
46 struct device_route *route;
48 iface = container_of(tree, struct interface, proto_route);
49 dev = iface->l3_dev->dev;
52 route = container_of(node_old, struct device_route, node);
53 if (!(route->flags & DEVADDR_EXTERNAL))
54 system_del_route(dev, route);
59 route = container_of(node_new, struct device_route, node);
60 if (!(route->flags & DEVADDR_EXTERNAL))
61 system_add_route(dev, route);
66 interface_ip_init(struct interface *iface)
68 vlist_init(&iface->proto_route, interface_update_proto_route,
69 struct device_route, node, mask, addr);
70 vlist_init(&iface->proto_addr, interface_update_proto_addr,
71 struct device_addr, node, mask, addr);