#include <linux/l2tp.h>
#include <linux/genetlink.h>
-#include "sd-netlink.h"
-
#include "conf-parser.h"
#include "hashmap.h"
#include "l2tp-tunnel.h"
-#include "missing.h"
#include "netlink-util.h"
#include "networkd-address.h"
#include "networkd-manager.h"
return;
if (s->tunnel && s->section)
- ordered_hashmap_remove(s->tunnel->sessions_by_section, s);
+ ordered_hashmap_remove(s->tunnel->sessions_by_section, s->section);
network_config_section_free(s->section);
static int l2tp_acquire_local_address(L2tpTunnel *t, Link *link, union in_addr_union *ret) {
Address *a;
- Iterator i;
assert(t);
assert(link);
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;
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);
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;
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;
}
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;
}
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;
}
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;
}
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;
}
static int netdev_l2tp_tunnel_verify(NetDev *netdev, const char *filename) {
L2tpTunnel *t;
L2tpSession *session;
- Iterator i;
assert(netdev);
assert(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);
const NetDevVTable l2tptnl_vtable = {
.object_size = sizeof(L2tpTunnel),
.init = l2tp_tunnel_init,
- .sections = "Match\0NetDev\0L2TP\0L2TPSession\0",
+ .sections = NETDEV_COMMON_SECTIONS "L2TP\0L2TPSession\0",
.create_after_configured = l2tp_create_tunnel,
.done = l2tp_tunnel_done,
.create_type = NETDEV_CREATE_AFTER_CONFIGURED,