summaryrefslogtreecommitdiffhomepage
path: root/interface-ip.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-10-14 00:47:17 +0200
committerFelix Fietkau <nbd@openwrt.org>2011-10-14 00:47:17 +0200
commit52c36d741c05db2350ad1d240f6bd5d72237d8fd (patch)
tree8c09e99a082490b93260f42f2e7e8e401adf22af /interface-ip.c
parentc000b546d97aa97144ee2cdf396d46a039bb7f98 (diff)
proto-shell: add dns search domains
Diffstat (limited to 'interface-ip.c')
-rw-r--r--interface-ip.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/interface-ip.c b/interface-ip.c
index 28c608a..a5efad5 100644
--- a/interface-ip.c
+++ b/interface-ip.c
@@ -119,6 +119,38 @@ interface_add_dns_server_list(struct interface *iface, struct blob_attr *list)
}
}
+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)
{