]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: add bridge link properties
authorSusant Sahani <susant@redhat.com>
Thu, 23 Jul 2015 18:01:58 +0000 (23:31 +0530)
committerSusant Sahani <susant@redhat.com>
Thu, 23 Jul 2015 18:01:58 +0000 (23:31 +0530)
new bridge properties

br.network

[Match]
Name=enp0s25

[Network]
Bridge=br-test

[Bridge]
Cost=332
BPDUGuard = true
HairPin = true
FastLeave = true
RootBlock = true
UnicastFlood = true

src/network/networkd-link.c
src/network/networkd-network-gperf.gperf
src/network/networkd.h

index 9550e89a15a1066c9fca0d929e4801f82bfc017b..55510b46e94be6a358c67e88492aab100578cd36 100644 (file)
@@ -846,9 +846,6 @@ static int link_set_bridge(Link *link) {
         assert(link);
         assert(link->network);
 
-        if(link->network->cost == 0)
-                return 0;
-
         r = sd_rtnl_message_new_link(link->manager->rtnl, &req, RTM_SETLINK, link->ifindex);
         if (r < 0)
                 return log_link_error_errno(link, r, "Could not allocate RTM_SETLINK message: %m");
@@ -861,6 +858,26 @@ static int link_set_bridge(Link *link) {
         if (r < 0)
                 return log_link_error_errno(link, r, "Could not append IFLA_PROTINFO attribute: %m");
 
+        r = sd_netlink_message_append_u8(req, IFLA_BRPORT_GUARD, link->network->bpdu_guard);
+        if (r < 0)
+                return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_GUARD attribute: %m");
+
+        r = sd_netlink_message_append_u8(req, IFLA_BRPORT_MODE, link->network->hairpin);
+        if (r < 0)
+                return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_MODE attribute: %m");
+
+        r = sd_netlink_message_append_u8(req, IFLA_BRPORT_FAST_LEAVE, link->network->fast_leave);
+        if (r < 0)
+                return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_FAST_LEAVE attribute: %m");
+
+        r = sd_netlink_message_append_u8(req, IFLA_BRPORT_PROTECT, link->network->root_block);
+        if (r < 0)
+                return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_PROTECT attribute: %m");
+
+        r = sd_netlink_message_append_u8(req, IFLA_BRPORT_UNICAST_FLOOD, link->network->unicast_flood);
+        if (r < 0)
+                return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_UNICAST_FLOOD attribute: %m");
+
         if(link->network->cost != 0) {
                 r = sd_netlink_message_append_u32(req, IFLA_BRPORT_COST, link->network->cost);
                 if (r < 0)
index 3a78c3d8a89abee280a702dabb3cd637bbcfab57..720f6b9d0bd7f672c48fbb6b2ec2c6051a1a5e0b 100644 (file)
@@ -73,6 +73,11 @@ DHCP.CriticalConnection,       config_parse_bool,                              0
 DHCP.VendorClassIdentifier,    config_parse_string,                            0,                             offsetof(Network, dhcp_vendor_class_identifier)
 DHCP.RouteMetric,              config_parse_unsigned,                          0,                             offsetof(Network, dhcp_route_metric)
 Bridge.Cost,                   config_parse_unsigned,                          0,                             offsetof(Network, cost)
+Bridge.BPDUGuard,              config_parse_bool,                              0,                             offsetof(Network, bpdu_guard)
+Bridge.HairPin,                config_parse_bool,                              0,                             offsetof(Network, hairpin)
+Bridge.FastLeave,              config_parse_bool,                              0,                             offsetof(Network, fast_leave)
+Bridge.RootBlock,              config_parse_bool,                              0,                             offsetof(Network, root_block)
+Bridge.UnicastFlood,           config_parse_bool,                              0,                             offsetof(Network, unicast_flood)
 BridgeFDB.MACAddress,          config_parse_fdb_hwaddr,                        0,                             0
 BridgeFDB.VLANId,              config_parse_fdb_vlan_id,                       0,                             0
 /* backwards compatibility: do not add new entries to this section */
index fb95f90169d76ca2a259dcf760a25ee07602ecce..6418c0a536a6368a84a0a412d850b2bf1d9556b2 100644 (file)
@@ -150,6 +150,11 @@ struct Network {
 
         bool dhcp_server;
 
+        bool bpdu_guard;
+        bool hairpin;
+        bool fast_leave;
+        bool root_block;
+        bool unicast_flood;
         unsigned cost;
 
         AddressFamilyBoolean ip_forward;