new package: rssileds daemon
[openwrt.git] / package / libnl-tiny / src / unl.c
index a60ba0829264094c3bb2fd445f56fb1c0360b79c..b38dab83978997450183716769c59ba6c696cac3 100644 (file)
@@ -1,3 +1,4 @@
+#define _GNU_SOURCE
 #include <netlink/netlink.h>
 #include <netlink/genl/genl.h>
 #include <netlink/genl/ctrl.h>
@@ -172,7 +173,7 @@ void unl_genl_loop(struct unl *unl, unl_cb handler, void *arg)
        nl_cb_put(cb);
 }
 
-static int unl_genl_multicast_id(struct unl *unl, const char *name)
+int unl_genl_multicast_id(struct unl *unl, const char *name)
 {
        struct nlattr *tb[CTRL_ATTR_MCAST_GRP_MAX + 1];
        struct nlattr *groups, *group;
@@ -190,11 +191,11 @@ static int unl_genl_multicast_id(struct unl *unl, const char *name)
        NLA_PUT_STRING(msg, CTRL_ATTR_FAMILY_NAME, unl->family_name);
        unl_genl_request_single(unl, msg, &msg);
        if (!msg)
-               goto nla_put_failure;
+               return -1;
 
        groups = unl_find_attr(unl, msg, CTRL_ATTR_MCAST_GROUPS);
        if (!groups)
-               goto fail;
+               goto nla_put_failure;
 
        nla_for_each_nested(group, groups, rem) {
                const char *gn;
@@ -214,9 +215,8 @@ static int unl_genl_multicast_id(struct unl *unl, const char *name)
                break;
        }
 
-fail:
-       nlmsg_free(msg);
 nla_put_failure:
+       nlmsg_free(msg);
        return ret;
 }