add IPv6 API for GTP tunnel

Extend existing API to allow to set family and IPv6 ms and sgsn address.
This commit is contained in:
Pablo Neira Ayuso 2023-03-30 22:15:33 +02:00 committed by Harald Welte
parent 28ca7cbf93
commit 9dc34d498a
3 changed files with 27 additions and 0 deletions

View File

@ -9,10 +9,13 @@ struct gtp_tunnel;
struct gtp_tunnel *gtp_tunnel_alloc(void);
void gtp_tunnel_free(struct gtp_tunnel *t);
void gtp_tunnel_set_family(struct gtp_tunnel *t, uint8_t family);
void gtp_tunnel_set_ifns(struct gtp_tunnel *t, int ifns);
void gtp_tunnel_set_ifidx(struct gtp_tunnel *t, uint32_t ifidx);
void gtp_tunnel_set_ms_ip4(struct gtp_tunnel *t, struct in_addr *ms_addr);
void gtp_tunnel_set_sgsn_ip4(struct gtp_tunnel *t, struct in_addr *sgsn_addr);
void gtp_tunnel_set_ms_ip6(struct gtp_tunnel *t, const struct in6_addr *ms_addr);
void gtp_tunnel_set_sgsn_ip6(struct gtp_tunnel *t, const struct in6_addr *sgsn_addr);
void gtp_tunnel_set_version(struct gtp_tunnel *t, uint32_t version);
void gtp_tunnel_set_tid(struct gtp_tunnel *t, uint64_t tid);
void gtp_tunnel_set_i_tei(struct gtp_tunnel *t, uint32_t i_tei);

View File

@ -46,6 +46,12 @@ void gtp_tunnel_free(struct gtp_tunnel *t)
}
EXPORT_SYMBOL(gtp_tunnel_free);
void gtp_tunnel_set_family(struct gtp_tunnel *t, uint8_t family)
{
t->family = family;
}
EXPORT_SYMBOL(gtp_tunnel_set_family);
void gtp_tunnel_set_ifns(struct gtp_tunnel *t, int ifns)
{
t->ifns = ifns;
@ -70,6 +76,18 @@ void gtp_tunnel_set_sgsn_ip4(struct gtp_tunnel *t, struct in_addr *sgsn_addr)
}
EXPORT_SYMBOL(gtp_tunnel_set_sgsn_ip4);
void gtp_tunnel_set_ms_ip6(struct gtp_tunnel *t, const struct in6_addr *ms_addr)
{
t->ip6.ms_addr = *ms_addr;
}
EXPORT_SYMBOL(gtp_tunnel_set_ms_ip6);
void gtp_tunnel_set_sgsn_ip6(struct gtp_tunnel *t, const struct in6_addr *sgsn_addr)
{
t->ip6.sgsn_addr = *sgsn_addr;
}
EXPORT_SYMBOL(gtp_tunnel_set_sgsn_ip6);
void gtp_tunnel_set_version(struct gtp_tunnel *t, uint32_t version)
{
t->gtp_version = version;

View File

@ -38,3 +38,9 @@ global:
local: *;
};
LIBGTPNL_1.1 {
gtp_tunnel_set_family;
gtp_tunnel_set_ms_ip6;
gtp_tunnel_set_sgsn_ip6;
} LIBGTPNL_1.0;