2 * netifd - network interface daemon
3 * Copyright (C) 2012 Felix Fietkau <nbd@openwrt.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2
7 * as published by the Free Software Foundation
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 #ifndef __INTERFACE_IP_H
15 #define __INTERFACE_IP_H
17 #include "interface.h"
19 enum device_addr_flags {
20 /* address family for routes and addresses */
21 DEVADDR_INET4 = (0 << 0),
22 DEVADDR_INET6 = (1 << 0),
23 DEVADDR_FAMILY = DEVADDR_INET4 | DEVADDR_INET6,
25 /* externally added address */
26 DEVADDR_EXTERNAL = (1 << 2),
28 /* route overrides the default interface metric */
29 DEVROUTE_METRIC = (1 << 3)
38 struct vlist_node node;
43 uint32_t point_to_point;
46 enum device_addr_flags flags;
52 struct vlist_node node;
53 struct interface *iface;
58 union if_addr nexthop;
63 enum device_addr_flags flags;
69 struct vlist_simple_node node;
74 struct dns_search_domain {
75 struct vlist_simple_node node;
79 extern const struct config_param_list route_attr_list;
81 void interface_ip_init(struct interface *iface);
82 void interface_add_dns_server(struct interface_ip_settings *ip, const char *str);
83 void interface_add_dns_server_list(struct interface_ip_settings *ip, struct blob_attr *list);
84 void interface_add_dns_search_list(struct interface_ip_settings *ip, struct blob_attr *list);
85 void interface_write_resolv_conf(void);
87 void interface_ip_add_route(struct interface *iface, struct blob_attr *attr, bool v6);
89 void interface_ip_update_start(struct interface_ip_settings *ip);
90 void interface_ip_update_complete(struct interface_ip_settings *ip);
91 void interface_ip_flush(struct interface_ip_settings *ip);
92 void interface_ip_set_enabled(struct interface_ip_settings *ip, bool enabled);
93 void interface_ip_update_metric(struct interface_ip_settings *ip, int metric);
95 struct interface *interface_ip_add_target_route(union if_addr *addr, bool v6);