X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;ds=sidebyside;f=proto.c;h=d8f16b33e2e45c9f5003e5c9670920edf0157e3b;hb=f505119b07b89ad23f4264e77b0bf0f0c0400399;hp=278fb0c33e736789765d4e1d4c602d66774fe641;hpb=0c823ed77d2d4aaca12d4c9504e808e4c715b8e4;p=project%2Fnetifd.git diff --git a/proto.c b/proto.c index 278fb0c..d8f16b3 100644 --- a/proto.c +++ b/proto.c @@ -48,14 +48,14 @@ default_proto_attach(const struct proto_handler *h, proto = calloc(1, sizeof(*proto)); proto->free = default_proto_free; - proto->flags = PROTO_FLAG_IMMEDIATE; - proto->handler = no_proto_handler; + proto->cb = no_proto_handler; return proto; } static const struct proto_handler no_proto = { .name = "none", + .flags = PROTO_FLAG_IMMEDIATE, .attach = default_proto_attach, }; @@ -84,9 +84,10 @@ proto_init_interface(struct interface *iface, struct blob_attr *attr) if (!state) { state = no_proto.attach(&no_proto, iface, attr); - state->handler = invalid_proto_handler; + state->cb = invalid_proto_handler; } + state->handler = proto; interface_set_proto_state(iface, state); } @@ -114,8 +115,8 @@ interface_proto_event(struct interface_proto_state *proto, enum interface_event ev; int ret; - ret = proto->handler(proto, cmd, force); - if (ret || !(proto->flags & PROTO_FLAG_IMMEDIATE)) + ret = proto->cb(proto, cmd, force); + if (ret || !(proto->handler->flags & PROTO_FLAG_IMMEDIATE)) goto out; switch(cmd) {