6decaea7b16861c0adc00cf4316f8f70f8242881
8 #include "interface-ip.h"
13 int interface_add_address(struct interface
*iface
, struct device_addr
*addr
)
17 if (addr
->flags
& DEVADDR_INET6
)
22 list_add_tail(&addr
->list
, &iface
->address
);
23 return system_add_address(iface
->l3_iface
->dev
, addr
);
26 void interface_del_address(struct interface
*iface
, struct device_addr
*addr
)
30 if (addr
->flags
& DEVADDR_INET6
)
35 list_del(&addr
->list
);
36 system_del_address(iface
->l3_iface
->dev
, addr
);
39 void interface_del_ctx_addr(struct interface
*iface
, void *ctx
)
41 struct device_addr
*addr
, *tmp
;
43 list_for_each_entry_safe(addr
, tmp
, &iface
->address
, list
) {
44 if (ctx
&& addr
->ctx
!= ctx
)
47 interface_del_address(iface
, addr
);
51 int interface_add_route(struct interface
*iface
, struct device_route
*route
)
53 list_add_tail(&route
->list
, &iface
->routes
);
54 return system_add_route(iface
->l3_iface
->dev
, route
);
57 void interface_del_route(struct interface
*iface
, struct device_route
*route
)
59 list_del(&route
->list
);
60 system_del_route(iface
->l3_iface
->dev
, route
);
63 void interface_del_all_routes(struct interface
*iface
)
65 struct device_route
*route
, *tmp
;
67 list_for_each_entry_safe(route
, tmp
, &iface
->routes
, list
)
68 interface_del_route(iface
, route
);