summaryrefslogtreecommitdiff
path: root/src/libsystemd-network
diff options
context:
space:
mode:
authorSusant Sahani <susant@redhat.com>2014-05-12 10:48:24 +0530
committerTom Gundersen <teg@jklm.no>2014-05-12 17:37:12 +0200
commit7951dea20911969287878e6897b3eca348721ade (patch)
tree420a101f2a4e3912b9d078bcf16bf06e8ff94742 /src/libsystemd-network
parent1727a595225132eb73ec134b6979d9c713b42e8c (diff)
networkd: introduce ipip tunnel
This patch enables basic ipip tunnel support. It works with kernel module ipip example conf: file: ipip.netdev [NetDev] Name=ipip-tun Kind=ipip MTUBytes=1480 [Tunnel] Local=192.168.223.238 Remote=192.169.224.239 TTL=64 file: ipip.network [Match] Name=em1 [Network] Tunnel=ipip-tun [tomegun: - drop unused variable - take ref when enslaving]
Diffstat (limited to 'src/libsystemd-network')
-rw-r--r--src/libsystemd-network/network-internal.c33
-rw-r--r--src/libsystemd-network/network-internal.h3
2 files changed, 36 insertions, 0 deletions
diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c
index 52e614c4ea..cf577e54a4 100644
--- a/src/libsystemd-network/network-internal.c
+++ b/src/libsystemd-network/network-internal.c
@@ -326,3 +326,36 @@ int net_parse_inaddr(const char *address, unsigned char *family, void *dst) {
return 0;
}
+
+int load_module(struct kmod_ctx *ctx, const char *mod_name) {
+ struct kmod_list *modlist = NULL, *l;
+ int r;
+
+ assert(ctx);
+ assert(mod_name);
+
+ r = kmod_module_new_from_lookup(ctx, mod_name, &modlist);
+ if (r < 0)
+ return r;
+
+ if (!modlist) {
+ log_error("Failed to find module '%s'", mod_name);
+ return -ENOENT;
+ }
+
+ kmod_list_foreach(l, modlist) {
+ struct kmod_module *mod = kmod_module_get_module(l);
+
+ r = kmod_module_probe_insert_module(mod, 0, NULL, NULL, NULL, NULL);
+ if (r == 0)
+ log_info("Inserted module '%s'", kmod_module_get_name(mod));
+ else {
+ log_error("Failed to insert '%s': %s", kmod_module_get_name(mod),
+ strerror(-r));
+ }
+ }
+
+ kmod_module_unref_list(modlist);
+
+ return r;
+}
diff --git a/src/libsystemd-network/network-internal.h b/src/libsystemd-network/network-internal.h
index 836472a776..1c77d33274 100644
--- a/src/libsystemd-network/network-internal.h
+++ b/src/libsystemd-network/network-internal.h
@@ -24,6 +24,7 @@
#include <netinet/ether.h>
#include <netinet/in.h>
#include <stdbool.h>
+#include <libkmod.h>
#include "udev.h"
#include "condition-util.h"
@@ -65,3 +66,5 @@ int config_parse_ifalias(const char *unit, const char *filename, unsigned line,
int net_parse_inaddr(const char *address, unsigned char *family, void *dst);
int net_get_unique_predictable_data(struct udev_device *device, uint8_t result[8]);
+
+int load_module(struct kmod_ctx *ctx, const char *mod_name);