system-linux: detect adding and removal of devices
[project/netifd.git] / interface-ip.h
1 #ifndef __INTERFACE_IP_H
2 #define __INTERFACE_IP_H
3
4 enum device_addr_flags {
5         /* address family for routes and addresses */
6         DEVADDR_INET4           = (0 << 0),
7         DEVADDR_INET6           = (1 << 0),
8         DEVADDR_FAMILY          = DEVADDR_INET4 | DEVADDR_INET6,
9
10         /* device route (no gateway) */
11         DEVADDR_DEVICE          = (1 << 1),
12
13         /* externally added address */
14         DEVADDR_EXTERNAL        = (1 << 2),
15 };
16
17 union if_addr {
18         struct in_addr in;
19         struct in6_addr in6;
20 };
21
22 struct device_addr {
23         struct vlist_node node;
24
25         enum device_addr_flags flags;
26
27         unsigned int mask;
28         union if_addr addr;
29 };
30
31 struct device_route {
32         struct vlist_node node;
33
34         enum device_addr_flags flags;
35         bool keep;
36
37         unsigned int mask;
38         union if_addr addr;
39         union if_addr nexthop;
40         struct device *device;
41 };
42
43 void interface_ip_init(struct interface *iface);
44
45 #endif