]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/network/networkd-netdev-ipvlan.c
util-lib: move string table stuff into its own string-table.[ch]
[thirdparty/systemd.git] / src / network / networkd-netdev-ipvlan.c
index 5189000c1fe543363c954d89050a7fda6561b371..27cb7d1bf012da15f4921793329436f80ea04ff8 100644 (file)
@@ -21,8 +21,9 @@
 
 #include <net/if.h>
 
-#include "networkd-netdev-ipvlan.h"
 #include "conf-parser.h"
+#include "networkd-netdev-ipvlan.h"
+#include "string-table.h"
 
 static const char* const ipvlan_mode_table[_NETDEV_IPVLAN_MODE_MAX] = {
         [NETDEV_IPVLAN_MODE_L2] = "L2",
@@ -32,32 +33,34 @@ static const char* const ipvlan_mode_table[_NETDEV_IPVLAN_MODE_MAX] = {
 DEFINE_STRING_TABLE_LOOKUP(ipvlan_mode, IPVlanMode);
 DEFINE_CONFIG_PARSE_ENUM(config_parse_ipvlan_mode, ipvlan_mode, IPVlanMode, "Failed to parse ipvlan mode");
 
-static int netdev_ipvlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *req) {
-        IPVlan *m = IPVLAN(netdev);
+static int netdev_ipvlan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *req) {
+        IPVlan *m;
         int r;
 
         assert(netdev);
-        assert(m);
         assert(link);
         assert(netdev->ifname);
 
+        m = IPVLAN(netdev);
+
+        assert(m);
+
         if (m->mode != _NETDEV_IPVLAN_MODE_INVALID) {
-        r = sd_rtnl_message_append_u16(req, IFLA_IPVLAN_MODE, m->mode);
-        if (r < 0) {
-                log_netdev_error(netdev,
-                                 "Could not append IFLA_IPVLAN_MODE attribute: %s",
-                                 strerror(-r));
-                        return r;
-                }
+                r = sd_netlink_message_append_u16(req, IFLA_IPVLAN_MODE, m->mode);
+                if (r < 0)
+                        return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPVLAN_MODE attribute: %m");
         }
 
         return 0;
 }
 
 static void ipvlan_init(NetDev *n) {
-        IPVlan *m = IPVLAN(n);
+        IPVlan *m;
 
         assert(n);
+
+        m = IPVLAN(n);
+
         assert(m);
 
         m->mode = _NETDEV_IPVLAN_MODE_INVALID;