jshn_append PROTO_DNS "$address"
}
+proto_add_dns_search() {
+ local address="$1"
+
+ jshn_append PROTO_DNS_SEARCH "$address"
+}
+
proto_add_ipv4_address() {
local address="$1"
local mask="$2"
_proto_push_array "route" "$PROTO_ROUTE" _proto_push_route
_proto_push_array "route6" "$PROTO_ROUTE6" _proto_push_route
_proto_push_array "dns" "$PROTO_DNS" _proto_push_ip
+ _proto_push_array "dns_search" "$PROTO_DNS_SEARCH" _proto_push_ip
_proto_notify "$interface"
}
}
}
+void
+interface_add_dns_search_domain(struct interface *iface, const char *str)
+{
+ struct dns_search_domain *s;
+ int len = strlen(str);
+
+ s = calloc(1, sizeof(*s) + len + 1);
+ if (!s)
+ return;
+
+ D(INTERFACE, "Add DNS search domain: %s\n", str);
+ memcpy(s->name, str, len);
+ list_add_tail(&s->list, &iface->proto_dns_search);
+}
+
+void
+interface_add_dns_search_list(struct interface *iface, struct blob_attr *list)
+{
+ struct blob_attr *cur;
+ int rem;
+
+ blobmsg_for_each_attr(cur, list, rem) {
+ if (blobmsg_type(cur) != BLOBMSG_TYPE_STRING)
+ continue;
+
+ if (!blobmsg_check_attr(cur, NULL))
+ continue;
+
+ interface_add_dns_server(iface, blobmsg_data(cur));
+ }
+}
+
static void
interface_clear_dns_servers(struct interface *iface)
{
void interface_ip_init(struct interface *iface);
void interface_add_dns_server(struct interface *iface, const char *str);
void interface_add_dns_server_list(struct interface *iface, struct blob_attr *list);
+void interface_add_dns_search_list(struct interface *iface, struct blob_attr *list);
void interface_clear_dns(struct interface *iface);
void interface_write_resolv_conf(void);
NOTIFY_ROUTES,
NOTIFY_ROUTES6,
NOTIFY_DNS,
+ NOTIFY_DNS_SEARCH,
__NOTIFY_LAST
};
[NOTIFY_ROUTES] = { .name = "routes", .type = BLOBMSG_TYPE_ARRAY },
[NOTIFY_ROUTES6] = { .name = "routes6", .type = BLOBMSG_TYPE_ARRAY },
[NOTIFY_DNS] = { .name = "dns", .type = BLOBMSG_TYPE_ARRAY },
+ [NOTIFY_DNS_SEARCH] = { .name = "dns_search", .type = BLOBMSG_TYPE_ARRAY },
};
static int
if ((cur = tb[NOTIFY_DNS]) != NULL)
interface_add_dns_server_list(state->proto.iface, cur);
+ if ((cur = tb[NOTIFY_DNS_SEARCH]) != NULL)
+ interface_add_dns_search_list(state->proto.iface, cur);
+
interface_ip_update_complete(state->proto.iface);
state->proto.proto_event(&state->proto, IFPEV_UP);