interface-ip: DNS name server sorting support in resolv.conf.auto
[project/netifd.git] / proto-static.c
index be68e8e..3e33c3d 100644 (file)
@@ -1,3 +1,16 @@
+/*
+ * netifd - network interface daemon
+ * Copyright (C) 2012 Felix Fietkau <nbd@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -20,7 +33,11 @@ struct static_proto_state {
 static bool
 static_proto_setup(struct static_proto_state *state)
 {
-       return proto_apply_ip_settings(state->proto.iface, state->config, false) == 0;
+       struct interface *iface = state->proto.iface;
+       struct device *dev = iface->main_dev.dev;
+
+       interface_set_l3_dev(iface, dev);
+       return proto_apply_static_ip_settings(state->proto.iface, state->config) == 0;
 }
 
 static int
@@ -39,8 +56,10 @@ static_handler(struct interface_proto_state *proto,
 
                break;
        case PROTO_CMD_TEARDOWN:
+       case PROTO_CMD_RENEW:
                break;
        }
+
        return ret;
 }
 
@@ -81,7 +100,8 @@ error:
 
 static struct proto_handler static_proto = {
        .name = "static",
-       .flags = PROTO_FLAG_IMMEDIATE,
+       .flags = PROTO_FLAG_IMMEDIATE |
+                PROTO_FLAG_FORCE_LINK_DEFAULT,
        .config_params = &proto_ip_attr,
        .attach = static_attach,
 };