networkd-netdev-tunnel.c revision 6436165dbc500f14abfec738af28f87a71f6a12a
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2014 Susant Sahani <susant@redhat.com>
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <linux/if_tunnel.h>
#include "sd-rtnl.h"
#include "networkd-netdev-tunnel.h"
#include "network-internal.h"
#include "util.h"
#include "missing.h"
#include "conf-parser.h"
int r;
assert(m);
assert(t);
if (r < 0) {
"Could not append IFLA_IPTUN_LINK attribute: %s",
strerror(-r));
return r;
}
if (r < 0) {
"Could not append IFLA_IPTUN_LOCAL attribute: %s",
strerror(-r));
return r;
}
if (r < 0) {
"Could not append IFLA_IPTUN_REMOTE attribute: %s",
strerror(-r));
return r;
}
if (r < 0) {
"Could not append IFLA_IPTUN_TTL attribute: %s",
strerror(-r));
return r;
}
return r;
}
int r;
assert(m);
assert(t);
if (r < 0) {
"Could not append IFLA_IPTUN_LINK attribute: %s",
strerror(-r));
return r;
}
if (r < 0) {
"Could not append IFLA_IPTUN_LOCAL attribute: %s",
strerror(-r));
return r;
}
if (r < 0) {
"Could not append IFLA_IPTUN_REMOTE attribute: %s",
strerror(-r));
return r;
}
if (r < 0) {
"Could not append IFLA_IPTUN_TTL attribute: %s",
strerror(-r));
return r;
}
return r;
}
int r;
assert(m);
assert(t);
if (r < 0) {
"Could not append IFLA_GRE_LINK attribute: %s",
strerror(-r));
return r;
}
if (r < 0) {
"Could not append IFLA_GRE_LOCAL attribute: %s",
strerror(-r));
return r;
}
if (r < 0) {
"Could not append IFLA_GRE_REMOTE attribute: %s",
strerror(-r));
return r;
}
if (r < 0) {
"Could not append IFLA_GRE_TTL attribute: %s",
strerror(-r));
return r;
}
if (r < 0) {
"Could not append IFLA_GRE_TOS attribute: %s",
strerror(-r));
return r;
}
return r;
}
int r;
assert(m);
assert(t);
if (r < 0) {
"Could not append IFLA_IPTUN_LINK attribute: %s",
strerror(-r));
return r;
}
if (r < 0) {
"Could not append IFLA_IPTUN_LOCAL attribute: %s",
strerror(-r));
return r;
}
if (r < 0) {
"Could not append IFLA_IPTUN_REMOTE attribute: %s",
strerror(-r));
return r;
}
return r;
}
case NETDEV_KIND_IPIP:
break;
case NETDEV_KIND_SIT:
break;
case NETDEV_KIND_GRE:
break;
case NETDEV_KIND_VTI:
break;
default:
assert_not_reached("Invalid tunnel kind");
}
assert(t);
return -EINVAL;
}
return -EINVAL;
}
return -EINVAL;
}
return 0;
}
int config_parse_tunnel_address(const char *unit,
const char *filename,
unsigned line,
const char *section,
unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
void *data,
void *userdata) {
int r, f;
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Tunnel address is invalid, ignoring assignment: %s", rvalue);
return 0;
}
log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Tunnel addresses incompatible, ignoring assignment: %s", rvalue);
return 0;
}
t->family = f;
return 0;
}
assert(n);
assert(t);
t->pmtudisc = true;
}
assert(n);
assert(t);
t->pmtudisc = true;
}
assert(n);
assert(t);
t->pmtudisc = true;
}
assert(n);
assert(t);
t->pmtudisc = true;
}
const NetDevVTable ipip_vtable = {
.object_size = sizeof(Tunnel),
.sections = "Match\0NetDev\0Tunnel\0",
};
const NetDevVTable sit_vtable = {
.object_size = sizeof(Tunnel),
.sections = "Match\0NetDev\0Tunnel\0",
};
const NetDevVTable vti_vtable = {
.object_size = sizeof(Tunnel),
.sections = "Match\0NetDev\0Tunnel\0",
};
const NetDevVTable gre_vtable = {
.object_size = sizeof(Tunnel),
.sections = "Match\0NetDev\0Tunnel\0",
};