diff options
author | Harald Welte <laforge@gnumonks.org> | 2017-03-15 18:03:42 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-03-24 15:39:17 +0100 |
commit | 6d60a402b25a1885a2c14598bef5588df78fd726 (patch) | |
tree | d9f5666f03a925f949cc8312ec162c5183fbd01a | |
parent | e17988ac7b857c6f5c250bf0ffa7bd530256a213 (diff) |
Add support for SGSN role via IFLA_GTP_ROLE
This patch corresponds to a Linux kernel patch extending the kernel GTP
to also cover the SGSN role, not just the GGSN role. In order to keep
the API/behavior compatible, gtp_dev_create() will continue to create
GGSN-side tunnels, while a new gtp_dev_create_sgsn() is introduced to
create SGSN-side tunnels.
Signed-off-by: Harald Welte <laforge@gnumonks.org>
-rw-r--r-- | include/libgtpnl/gtpnl.h | 1 | ||||
-rw-r--r-- | include/linux/if_link.h | 7 | ||||
-rw-r--r-- | src/gtp-rtnl.c | 14 |
3 files changed, 21 insertions, 1 deletions
diff --git a/include/libgtpnl/gtpnl.h b/include/libgtpnl/gtpnl.h index 49ba03d..33bb275 100644 --- a/include/libgtpnl/gtpnl.h +++ b/include/libgtpnl/gtpnl.h @@ -17,6 +17,7 @@ int genl_lookup_family(struct mnl_socket *nl, const char *family); struct in_addr; int gtp_dev_create(int dest_ns, const char *gtp_ifname, int fd0, int fd1); +int gtp_dev_create_sgsn(int dest_ns, const char *gtp_ifname, int fd0, int fd1); int gtp_dev_config(const char *iface, struct in_addr *net, uint32_t prefix); int gtp_dev_destroy(const char *gtp_ifname); diff --git a/include/linux/if_link.h b/include/linux/if_link.h index a3f53c9..c66ebbd 100644 --- a/include/linux/if_link.h +++ b/include/linux/if_link.h @@ -518,11 +518,18 @@ enum { #define IFLA_GENEVE_MAX (__IFLA_GENEVE_MAX - 1) /* GTP section */ + +enum ifla_gtp_role { + GTP_ROLE_GGSN = 0, + GTP_ROLE_SGSN, +}; + enum { IFLA_GTP_UNSPEC, IFLA_GTP_FD0, IFLA_GTP_FD1, IFLA_GTP_PDP_HASHSIZE, + IFLA_GTP_ROLE, __IFLA_GTP_MAX, }; #define IFLA_GTP_MAX (__IFLA_GTP_MAX - 1) diff --git a/src/gtp-rtnl.c b/src/gtp-rtnl.c index 6bfec65..256de43 100644 --- a/src/gtp-rtnl.c +++ b/src/gtp-rtnl.c @@ -105,7 +105,8 @@ static int gtp_dev_talk(struct nlmsghdr *nlh, uint32_t seq) return ret; } -int gtp_dev_create(int dest_ns, const char *gtp_ifname, int fd0, int fd1) +static int _gtp_dev_create(int dest_ns, const char *gtp_ifname, int fd0, + int fd1, enum ifla_gtp_role role) { char buf[MNL_SOCKET_BUFFER_SIZE]; struct nlmsghdr *nlh; @@ -134,8 +135,19 @@ int gtp_dev_create(int dest_ns, const char *gtp_ifname, int fd0, int fd1) return gtp_dev_talk(nlh, seq); } + +int gtp_dev_create(int dest_ns, const char *gtp_ifname, int fd0, int fd1) +{ + return _gtp_dev_create(dest_ns, gtp_ifname, fd0, fd1, GTP_ROLE_GGSN); +} EXPORT_SYMBOL(gtp_dev_create); +int gtp_dev_create_sgsn(int dest_ns, const char *gtp_ifname, int fd0, int fd1) +{ + return _gtp_dev_create(dest_ns, gtp_ifname, fd0, fd1, GTP_ROLE_SGSN); +} +EXPORT_SYMBOL(gtp_dev_create_sgsn); + int gtp_dev_destroy(const char *gtp_ifname) { char buf[MNL_SOCKET_BUFFER_SIZE]; |