]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/network/netdev/l2tp-tunnel.c
tree-wide: define iterator inside of the macro
[thirdparty/systemd.git] / src / network / netdev / l2tp-tunnel.c
index 91788c3681938fc28eb296cdeb9313203310c322..949f124ccd66fdeb46a0a73677fb57f97d44605b 100644 (file)
@@ -275,7 +275,6 @@ static int l2tp_acquire_local_address_one(L2tpTunnel *t, Address *a, union in_ad
 
 static int l2tp_acquire_local_address(L2tpTunnel *t, Link *link, union in_addr_union *ret) {
         Address *a;
-        Iterator i;
 
         assert(t);
         assert(link);
@@ -288,11 +287,11 @@ static int l2tp_acquire_local_address(L2tpTunnel *t, Link *link, union in_addr_u
                 return 0;
         }
 
-        SET_FOREACH(a, link->addresses, i)
+        SET_FOREACH(a, link->addresses)
                 if (l2tp_acquire_local_address_one(t, a, ret) >= 0)
                         return 1;
 
-        SET_FOREACH(a, link->addresses_foreign, i)
+        SET_FOREACH(a, link->addresses_foreign)
                 if (l2tp_acquire_local_address_one(t, a, ret) >= 0)
                         return 1;
 
@@ -348,7 +347,6 @@ static int l2tp_create_session(NetDev *netdev, L2tpSession *session) {
 static int l2tp_create_tunnel_handler(sd_netlink *rtnl, sd_netlink_message *m, NetDev *netdev) {
         L2tpSession *session;
         L2tpTunnel *t;
-        Iterator i;
         int r;
 
         assert(netdev);
@@ -370,7 +368,7 @@ static int l2tp_create_tunnel_handler(sd_netlink *rtnl, sd_netlink_message *m, N
 
         log_netdev_debug(netdev, "L2TP tunnel is created");
 
-        ORDERED_HASHMAP_FOREACH(session, t->sessions_by_section, i)
+        ORDERED_HASHMAP_FOREACH(session, t->sessions_by_section)
                 (void) l2tp_create_session(netdev, session);
 
         return 1;
@@ -459,7 +457,7 @@ int config_parse_l2tp_tunnel_address(
         else
                 r = in_addr_from_string(t->family, rvalue, addr);
         if (r < 0) {
-                log_syntax(unit, LOG_ERR, filename, line, r,
+                log_syntax(unit, LOG_WARNING, filename, line, r,
                            "Invalid L2TP Tunnel address specified in %s='%s', ignoring assignment: %m", lvalue, rvalue);
                 return 0;
         }
@@ -489,13 +487,13 @@ int config_parse_l2tp_tunnel_id(
 
         r = safe_atou32(rvalue, &k);
         if (r < 0) {
-                log_syntax(unit, LOG_ERR, filename, line, r,
+                log_syntax(unit, LOG_WARNING, filename, line, r,
                            "Failed to parse L2TP tunnel id. Ignoring assignment: %s", rvalue);
                 return 0;
         }
 
         if (k == 0) {
-                log_syntax(unit, LOG_ERR, filename, line, r,
+                log_syntax(unit, LOG_WARNING, filename, line, 0,
                            "Invalid L2TP tunnel id. Ignoring assignment: %s", rvalue);
                 return 0;
         }
@@ -530,17 +528,17 @@ int config_parse_l2tp_session_id(
 
         r = l2tp_session_new_static(t, filename, section_line, &session);
         if (r < 0)
-                return r;
+                return log_oom();
 
         r = safe_atou32(rvalue, &k);
         if (r < 0) {
-                log_syntax(unit, LOG_ERR, filename, line, r,
+                log_syntax(unit, LOG_WARNING, filename, line, r,
                            "Failed to parse L2TP session id. Ignoring assignment: %s", rvalue);
                 return 0;
         }
 
         if (k == 0) {
-                log_syntax(unit, LOG_ERR, filename, line, r,
+                log_syntax(unit, LOG_WARNING, filename, line, 0,
                            "Invalid L2TP session id. Ignoring assignment: %s", rvalue);
                 return 0;
         }
@@ -579,11 +577,11 @@ int config_parse_l2tp_session_l2spec(
 
         r = l2tp_session_new_static(t, filename, section_line, &session);
         if (r < 0)
-                return r;
+                return log_oom();
 
         spec = l2tp_l2spec_type_from_string(rvalue);
         if (spec < 0) {
-                log_syntax(unit, LOG_ERR, filename, line, 0,
+                log_syntax(unit, LOG_WARNING, filename, line, 0,
                            "Failed to parse layer2 specific header type. Ignoring assignment: %s", rvalue);
                 return 0;
         }
@@ -618,10 +616,10 @@ int config_parse_l2tp_session_name(
 
         r = l2tp_session_new_static(t, filename, section_line, &session);
         if (r < 0)
-                return r;
+                return log_oom();
 
         if (!ifname_valid(rvalue)) {
-                log_syntax(unit, LOG_ERR, filename, line, 0,
+                log_syntax(unit, LOG_WARNING, filename, line, 0,
                            "Failed to parse L2TP tunnel session name. Ignoring assignment: %s", rvalue);
                 return 0;
         }
@@ -677,7 +675,6 @@ static int l2tp_session_verify(L2tpSession *session) {
 static int netdev_l2tp_tunnel_verify(NetDev *netdev, const char *filename) {
         L2tpTunnel *t;
         L2tpSession *session;
-        Iterator i;
 
         assert(netdev);
         assert(filename);
@@ -701,7 +698,7 @@ static int netdev_l2tp_tunnel_verify(NetDev *netdev, const char *filename) {
                                               "%s: L2TP tunnel without tunnel IDs configured. Ignoring",
                                               filename);
 
-        ORDERED_HASHMAP_FOREACH(session, t->sessions_by_section, i)
+        ORDERED_HASHMAP_FOREACH(session, t->sessions_by_section)
                 if (l2tp_session_verify(session) < 0)
                         l2tp_session_free(session);