]> git.ipfire.org Git - network.git/commitdiff
zones: Move "struct nw_zone" into header
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 11 Jun 2023 13:09:41 +0000 (13:09 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 11 Jun 2023 13:09:41 +0000 (13:09 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/networkd/port-vlan.h
src/networkd/port.h
src/networkd/zone.c
src/networkd/zone.h

index e17f7e7ad4d2e335fac7e08f9ee75134c0e635c7..c8072389d521cf8acfc40bfe1a89af0474972769 100644 (file)
@@ -47,7 +47,7 @@ struct nw_port_vlan {
 
        // If the parent has not been read from the configuration we will
        // save the name and try to find it later.
-       char __parent_name[IF_NAMESIZE];
+       char __parent_name[IFNAMSIZ];
 };
 
 extern const nw_port_type_t nw_port_type_vlan;
index 3cbe4b0918f071812626ef768f791c1c274ae86f..422a65f21c027679e59570c97d27b7bd4b6b388e 100644 (file)
 
 #include <systemd/sd-netlink.h>
 
-#ifndef IF_NAMESIZE
-#define IF_NAMESIZE 16
-#endif
-
 #define PORT_CONFIG_DIR                        CONFIG_DIR "/ports"
 
 typedef struct nw_port nw_port;
@@ -82,7 +78,7 @@ struct nw_port {
        nw_link* link;
 
        const nw_port_type_t* type;
-       char name[IF_NAMESIZE];
+       char name[IFNAMSIZ];
 
        // Configuration
        nw_config *config;
index 19d221fbb720138d1c4f09934c81f0c1ec1a48d6..1610dc0c137893cc5aa223b1c5540deb6fce9256 100644 (file)
@@ -38,19 +38,6 @@ static const nw_string_table_t nw_zone_type_id[] = {
 
 NW_STRING_TABLE_LOOKUP(nw_zone_type_id_t, nw_zone_type_id)
 
-struct nw_zone {
-       nw_daemon* daemon;
-       int nrefs;
-
-       // Link
-       nw_link* link;
-
-       char name[NETWORK_ZONE_NAME_MAX_LENGTH];
-
-       // Configuration
-       nw_config *config;
-};
-
 static void nw_zone_free(nw_zone* zone) {
        if (zone->link)
                nw_link_unref(zone->link);
index 6ab951b4a6243906e94d4f544e0e79b2b3f9663a..2d1e1dc0ce6fa2d8d552c7756d2659de807c26de 100644 (file)
@@ -23,7 +23,6 @@
 
 #define ZONE_CONFIG_DIR                        CONFIG_DIR "/zones"
 
-#define NETWORK_ZONE_NAME_MAX_LENGTH           16
 #define NETWORK_ZONE_DEFAULT_MTU                       1500
 
 typedef struct nw_zone nw_zone;
@@ -32,10 +31,25 @@ typedef enum nw_zone_type_id {
        __EMPTY
 } nw_zone_type_id_t;
 
+#include <linux/if.h>
 #include <linux/if_link.h>
 
 #include "config.h"
 #include "daemon.h"
+#include "link.h"
+
+struct nw_zone {
+       nw_daemon* daemon;
+       int nrefs;
+
+       // Link
+       nw_link* link;
+
+       char name[IFNAMSIZ];
+
+       // Configuration
+       nw_config *config;
+};
 
 int nw_zone_create(nw_zone** zone, nw_daemon* daemon, const nw_zone_type_id_t type,
        const char* name, nw_config* config);