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];