chiark / gitweb /
sd-rtnl/networkd: use new rtnl_message_read() API and drop helper
authorTom Gundersen <teg@jklm.no>
Thu, 6 Mar 2014 18:44:37 +0000 (19:44 +0100)
committerTom Gundersen <teg@jklm.no>
Thu, 6 Mar 2014 18:44:37 +0000 (19:44 +0100)
With the new sd_rtnl_message_read_string(), there is no longer a need for
rtnl_message_get_ifname().

src/libsystemd/sd-rtnl/rtnl-util.c
src/libsystemd/sd-rtnl/rtnl-util.h
src/network/networkd-manager.c

index fc834e9..c8b20d1 100644 (file)
@@ -153,19 +153,3 @@ bool rtnl_message_type_is_addr(uint16_t type) {
                         return false;
         }
 }
-
-int rtnl_message_link_get_ifname(sd_rtnl_message *message, const char **ret) {
-        unsigned short type;
-        void *name;
-
-        assert(rtnl_message_type_is_link(message->hdr->nlmsg_type));
-
-        while (sd_rtnl_message_read(message, &type, &name)) {
-                if (type == IFLA_IFNAME) {
-                        *ret = name;
-                        return 0;
-                }
-        }
-
-        return -ENOENT;
-}
index 33746af..7fe9222 100644 (file)
@@ -37,8 +37,6 @@ bool rtnl_message_type_is_route(uint16_t type);
 int rtnl_set_link_name(sd_rtnl *rtnl, int ifindex, const char *name);
 int rtnl_set_link_properties(sd_rtnl *rtnl, int ifindex, const char *alias, const struct ether_addr *mac, unsigned mtu);
 
-int rtnl_message_link_get_ifname(sd_rtnl_message *m, const char **ret);
-
 DEFINE_TRIVIAL_CLEANUP_FUNC(sd_rtnl*, sd_rtnl_unref);
 DEFINE_TRIVIAL_CLEANUP_FUNC(sd_rtnl_message*, sd_rtnl_message_unref);
 
index c89adfb..f41914f 100644 (file)
@@ -303,7 +303,7 @@ int manager_udev_listen(Manager *m) {
 static int manager_rtnl_process_link(sd_rtnl *rtnl, sd_rtnl_message *message, void *userdata) {
         Manager *m = userdata;
         Link *link;
-        const char *name;
+        char *name;
         int r, ifindex;
 
         assert(rtnl);
@@ -316,7 +316,7 @@ static int manager_rtnl_process_link(sd_rtnl *rtnl, sd_rtnl_message *message, vo
                 return 0;
         }
 
-        r = rtnl_message_link_get_ifname(message, &name);
+        r = sd_rtnl_message_read_string(message, IFLA_IFNAME, &name);
         if (r < 0)
                 log_debug("received RTM_NEWLINK message without valid IFLA_IFNAME");
         else {