diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-01-24 22:39:11 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2012-01-24 22:39:11 +0100 |
commit | 79368a64dbeba1bde4e03222ae82c1b22d66b37d (patch) | |
tree | 8345c7520612c75b84c9648d673df5b02f55f9a2 /proto.c | |
parent | c6b739e28f2b15789c95dd28af3f193ec8f67531 (diff) |
make sure iface->proto_handler is always initialized
Diffstat (limited to 'proto.c')
-rw-r--r-- | proto.c | 19 |
1 files changed, 8 insertions, 11 deletions
@@ -176,17 +176,14 @@ proto_init_interface(struct interface *iface, struct blob_attr *attr) void proto_attach_interface(struct interface *iface, const char *proto_name) { - const struct proto_handler *proto = NULL; - - if (!proto_name) { - interface_add_error(iface, "proto", "NO_PROTO", NULL, 0); - return; - } - - proto = get_proto_handler(proto_name); - if (!proto) { - interface_add_error(iface, "proto", "INVALID_PROTO", NULL, 0); - proto = &no_proto; + const struct proto_handler *proto = &no_proto; + + if (proto_name) { + proto = get_proto_handler(proto_name); + if (!proto) { + interface_add_error(iface, "proto", "INVALID_PROTO", NULL, 0); + proto = &no_proto; + } } iface->proto_handler = proto; |