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
);
40 void interface_del_ctx_addr(struct interface
*iface
, void *ctx
)
42 struct device_addr
*addr
, *tmp
;
44 list_for_each_entry_safe(addr
, tmp
, &iface
->address
, list
) {
45 if (ctx
&& addr
->ctx
!= ctx
)
48 interface_del_address(iface
, addr
);
52 int interface_add_route(struct interface
*iface
, struct device_route
*route
)
54 list_add_tail(&route
->list
, &iface
->routes
);
55 return system_add_route(iface
->l3_iface
->dev
, route
);
58 void interface_del_route(struct interface
*iface
, struct device_route
*route
)
60 list_del(&route
->list
);
61 system_del_route(iface
->l3_iface
->dev
, route
);
66 void interface_del_all_routes(struct interface
*iface
)
68 struct device_route
*route
, *tmp
;
70 list_for_each_entry_safe(route
, tmp
, &iface
->routes
, list
)
71 interface_del_route(iface
, route
);