lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

October 2023

  • 1 participants
  • 1843 discussions
[S] Change in libgtpnl[master]: gtp-genl: allocate room for maximum IPv6 address
by osmith 13 Oct '23

13 Oct '23
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/libgtpnl/+/34738?usp=email ) Change subject: gtp-genl: allocate room for maximum IPv6 address ...................................................................... gtp-genl: allocate room for maximum IPv6 address Otherwise, inet_ntop() might return ENOSPC because of the buffer being too small to accomodate an IPv6 address. Change-Id: I2283e0c3112bec8e6e7e7b5c96657facc09d0a7a --- M src/gtp-genl.c 1 file changed, 13 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libgtpnl refs/changes/38/34738/1 diff --git a/src/gtp-genl.c b/src/gtp-genl.c index 0c90894..4e4e63d 100644 --- a/src/gtp-genl.c +++ b/src/gtp-genl.c @@ -187,7 +187,7 @@ static int genl_gtp_attr_cb(const struct nlmsghdr *nlh, void *data) { struct nlattr *tb[GTPA_MAX + 1] = {}; - char buf[INET_ADDRSTRLEN]; + char buf[INET6_ADDRSTRLEN]; struct gtp_pdp pdp = {}; struct genlmsghdr *genl; -- To view, visit https://gerrit.osmocom.org/c/libgtpnl/+/34738?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libgtpnl Gerrit-Branch: master Gerrit-Change-Id: I2283e0c3112bec8e6e7e7b5c96657facc09d0a7a Gerrit-Change-Number: 34738 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in libgtpnl[master]: tools: gtp-tunnel: add IPv6 support
by osmith 13 Oct '23

13 Oct '23
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/libgtpnl/+/34737?usp=email ) Change subject: tools: gtp-tunnel: add IPv6 support ...................................................................... tools: gtp-tunnel: add IPv6 support This breaks backward compatibility, but this tool is intended for testing purpose. Change-Id: Ifdc104b158afa6343e3aa6142ffa9591db209c4f --- M tools/gtp-tunnel.c 1 file changed, 61 insertions(+), 13 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libgtpnl refs/changes/37/34737/1 diff --git a/tools/gtp-tunnel.c b/tools/gtp-tunnel.c index 1868097..3f5de5f 100644 --- a/tools/gtp-tunnel.c +++ b/tools/gtp-tunnel.c @@ -43,22 +43,29 @@ static void add_usage(const char *name) { - printf("%s add <gtp device> <v0> <tid> <ms-addr> <sgsn-addr>\n", + printf("%s add <gtp device> <v0> <tid> <family> <ms-addr> <sgsn-addr>\n", name); - printf("%s add <gtp device> <v1> <i_tei> <o_tei> <ms-addr> <sgsn-addr>\n", + printf("%s add <gtp device> <v1> <i_tei> <o_tei> <family> <ms-addr> <sgsn-addr>\n", name); } static int add_tunnel(int argc, char *argv[], int genl_id, struct mnl_socket *nl) { + union { + struct in_addr addr; + struct in6_addr addr6; + } ms; + union { + struct in_addr addr; + struct in6_addr addr6; + } sgsn; struct gtp_tunnel *t; - uint32_t gtp_ifidx; - struct in_addr ms, sgsn; uint32_t gtp_version; - int optidx; + uint32_t gtp_ifidx; + int optidx, family; - if (argc < 7 || argc > 8) { + if (argc < 8 || argc > 9) { add_usage(argv[0]); return EXIT_FAILURE; } @@ -95,17 +102,46 @@ gtp_tunnel_set_o_tei(t, atoi(argv[optidx++])); } - if (inet_aton(argv[optidx++], &ms) < 0) { - perror("bad address for ms"); - exit(EXIT_FAILURE); + if (!strcmp(argv[optidx], "ip")) { + family = AF_INET; + } else if (!strcmp(argv[optidx], "ip6")) { + family = AF_INET6; + } else { + fprintf(stderr, "wrong family `%s', expecting `ip' or `ip6'\n", argv[optidx]); + return EXIT_FAILURE; } - gtp_tunnel_set_ms_ip4(t, &ms); - if (inet_aton(argv[optidx++], &sgsn) < 0) { - perror("bad address for sgsn"); + gtp_tunnel_set_family(t, family); + + optidx++; + + if (inet_pton(family, argv[optidx++], &ms) <= 0) { + fprintf(stderr, "bad address for ms\n"); exit(EXIT_FAILURE); } - gtp_tunnel_set_sgsn_ip4(t, &sgsn); + + switch (family) { + case AF_INET: + gtp_tunnel_set_ms_ip4(t, &ms.addr); + break; + case AF_INET6: + gtp_tunnel_set_ms_ip6(t, &ms.addr6); + break; + } + + if (inet_pton(family, argv[optidx++], &sgsn) <= 0) { + fprintf(stderr, "bad address for sgsn\n"); + exit(EXIT_FAILURE); + } + + switch (family) { + case AF_INET: + gtp_tunnel_set_sgsn_ip4(t, &sgsn.addr); + break; + case AF_INET6: + gtp_tunnel_set_sgsn_ip6(t, &sgsn.addr6); + break; + } gtp_add_tunnel(genl_id, nl, t); -- To view, visit https://gerrit.osmocom.org/c/libgtpnl/+/34737?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libgtpnl Gerrit-Branch: master Gerrit-Change-Id: Ifdc104b158afa6343e3aa6142ffa9591db209c4f Gerrit-Change-Number: 34737 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in libgtpnl[master]: IPv4-in-IPv6-GTP and IPv6-in-IPv4-GTP
by osmith 13 Oct '23

13 Oct '23
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/libgtpnl/+/34739?usp=email ) Change subject: IPv4-in-IPv6-GTP and IPv6-in-IPv4-GTP ...................................................................... IPv4-in-IPv6-GTP and IPv6-in-IPv4-GTP allow to combine: - GTPA_MS_ADDRESS and GTPA_PEER_ADDR6 - GTPA_MS_ADDR6 and GTPA_PEER_ADDRESS to specify IPv4-in-IPv6-GTP and IPv6-in-IPv4-GTP in the tunnel declaration from control plane. Remove union in gtp_pdp and gtp_tunnel objects, since ms and sgsn fields might now use different IP family. Update listing to support too to deal with this new feature. Update syntax of gtp-tunnel tool: add <gtp device> <v0> <tid> <family> <ms-addr> <family> <sgsn-addr> add <gtp device> <v1> <i_tei> <o_tei> <family> <ms-addr> <family> <sgsn-addr> to allow specify the family for the peer (sgsn) address too. Changes by Oliver: - cosmetics Change-Id: Ibc581a92a561dc0bd9924d9f15c7a27dc513c8d7 --- M src/gtp-genl.c M src/internal.h M tools/gtp-tunnel.c 3 files changed, 93 insertions(+), 34 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libgtpnl refs/changes/39/34739/1 diff --git a/src/gtp-genl.c b/src/gtp-genl.c index 4e4e63d..2cf4102 100644 --- a/src/gtp-genl.c +++ b/src/gtp-genl.c @@ -53,11 +53,18 @@ case AF_INET: if (t->ip.sgsn_addr.s_addr) mnl_attr_put_u32(nlh, GTPA_PEER_ADDRESS, t->ip.sgsn_addr.s_addr); + else + mnl_attr_put(nlh, GTPA_PEER_ADDR6, sizeof(t->ip6.sgsn_addr), &t->ip6.sgsn_addr); + if (t->ip.ms_addr.s_addr) mnl_attr_put_u32(nlh, GTPA_MS_ADDRESS, t->ip.ms_addr.s_addr); break; case AF_INET6: - mnl_attr_put(nlh, GTPA_PEER_ADDR6, sizeof(t->ip6.sgsn_addr), &t->ip6.sgsn_addr); + if (t->ip.sgsn_addr.s_addr) + mnl_attr_put_u32(nlh, GTPA_PEER_ADDRESS, t->ip.sgsn_addr.s_addr); + else + mnl_attr_put(nlh, GTPA_PEER_ADDR6, sizeof(t->ip6.sgsn_addr), &t->ip6.sgsn_addr); + mnl_attr_put(nlh, GTPA_MS_ADDR6, sizeof(t->ip6.ms_addr), &t->ip6.ms_addr); break; } @@ -126,16 +133,14 @@ uint32_t o_tei; } v1; } u; - union { - struct { - struct in_addr sgsn_addr; - struct in_addr ms_addr; - } ip; - struct { - struct in6_addr sgsn_addr; - struct in6_addr ms_addr; - } ip6; - }; + struct { + struct in_addr sgsn_addr; + struct in_addr ms_addr; + } ip; + struct { + struct in6_addr sgsn_addr; + struct in6_addr ms_addr; + } ip6; }; static int genl_gtp_validate_cb(const struct nlattr *attr, void *data) @@ -188,6 +193,7 @@ { struct nlattr *tb[GTPA_MAX + 1] = {}; char buf[INET6_ADDRSTRLEN]; + int peer_family = AF_UNSPEC; struct gtp_pdp pdp = {}; struct genlmsghdr *genl; @@ -204,16 +210,21 @@ if (tb[GTPA_O_TEI]) pdp.u.v1.o_tei = mnl_attr_get_u32(tb[GTPA_O_TEI]); + if (tb[GTPA_PEER_ADDRESS]) { + pdp.ip.sgsn_addr.s_addr = mnl_attr_get_u32(tb[GTPA_PEER_ADDRESS]); + peer_family = AF_INET; + } else if (tb[GTPA_PEER_ADDR6]) { + memcpy(&pdp.ip6.sgsn_addr, mnl_attr_get_payload(tb[GTPA_PEER_ADDR6]), + sizeof(struct in6_addr)); + peer_family = AF_INET6; + } + switch (pdp.family) { case AF_INET: - if (tb[GTPA_PEER_ADDRESS]) - pdp.ip.sgsn_addr.s_addr = mnl_attr_get_u32(tb[GTPA_PEER_ADDRESS]); if (tb[GTPA_MS_ADDRESS]) pdp.ip.ms_addr.s_addr = mnl_attr_get_u32(tb[GTPA_MS_ADDRESS]); break; case AF_INET6: - if (tb[GTPA_PEER_ADDR6]) - memcpy(&pdp.ip6.sgsn_addr, mnl_attr_get_payload(tb[GTPA_PEER_ADDR6]), sizeof(struct in6_addr)); if (tb[GTPA_MS_ADDR6]) memcpy(&pdp.ip6.ms_addr, mnl_attr_get_payload(tb[GTPA_MS_ADDR6]), sizeof(struct in6_addr)); break; @@ -228,18 +239,27 @@ else if (pdp.version == GTP_V1) printf("tei %u/%u ", pdp.u.v1.i_tei, pdp.u.v1.o_tei); - printf("family %s ", pdp.family == AF_INET6 ? "ip6" : "ip"); + printf("%s ", pdp.family == AF_INET6 ? "ip6" : "ip"); switch (pdp.family) { case AF_INET: inet_ntop(AF_INET, &pdp.ip.ms_addr, buf, sizeof(buf)); printf("ms_addr %s ", buf); - inet_ntop(AF_INET, &pdp.ip.sgsn_addr, buf, sizeof(buf)); - printf("sgsn_addr %s\n", buf); break; case AF_INET6: inet_ntop(AF_INET6, &pdp.ip6.ms_addr, buf, sizeof(buf)); printf("ms_addr6 %s ", buf); + break; + } + + printf("%s ", peer_family == AF_INET6 ? "ip6" : "ip"); + + switch (peer_family) { + case AF_INET: + inet_ntop(AF_INET, &pdp.ip.sgsn_addr, buf, sizeof(buf)); + printf("sgsn_addr %s\n", buf); + break; + case AF_INET6: inet_ntop(AF_INET6, &pdp.ip6.sgsn_addr, buf, sizeof(buf)); printf("sgsn_addr6 %s\n", buf); break; diff --git a/src/internal.h b/src/internal.h index 8e8b3c5..10be913 100644 --- a/src/internal.h +++ b/src/internal.h @@ -16,16 +16,14 @@ uint8_t family; int ifns; uint32_t ifidx; - union { - struct { - struct in_addr ms_addr; - struct in_addr sgsn_addr; - } ip; - struct { - struct in6_addr ms_addr; - struct in6_addr sgsn_addr; - } ip6; - }; + struct { + struct in_addr ms_addr; + struct in_addr sgsn_addr; + } ip; + struct { + struct in6_addr ms_addr; + struct in6_addr sgsn_addr; + } ip6; int gtp_version; union { struct { diff --git a/tools/gtp-tunnel.c b/tools/gtp-tunnel.c index 3f5de5f..3033d64 100644 --- a/tools/gtp-tunnel.c +++ b/tools/gtp-tunnel.c @@ -43,9 +43,9 @@ static void add_usage(const char *name) { - printf("%s add <gtp device> <v0> <tid> <family> <ms-addr> <sgsn-addr>\n", + printf("%s add <gtp device> <v0> <tid> <family> <ms-addr> <family> <sgsn-addr>\n", name); - printf("%s add <gtp device> <v1> <i_tei> <o_tei> <family> <ms-addr> <sgsn-addr>\n", + printf("%s add <gtp device> <v1> <i_tei> <o_tei> <family> <ms-addr> <family> <sgsn-addr>\n", name); } @@ -60,12 +60,12 @@ struct in_addr addr; struct in6_addr addr6; } sgsn; + int optidx, family, peer_family; struct gtp_tunnel *t; uint32_t gtp_version; uint32_t gtp_ifidx; - int optidx, family; - if (argc < 8 || argc > 9) { + if (argc < 9 || argc > 10) { add_usage(argv[0]); return EXIT_FAILURE; } @@ -129,12 +129,22 @@ break; } - if (inet_pton(family, argv[optidx++], &sgsn) <= 0) { + if (!strcmp(argv[optidx], "ip")) { + peer_family = AF_INET; + } else if (!strcmp(argv[optidx], "ip6")) { + peer_family = AF_INET6; + } else { + fprintf(stderr, "wrong family `%s', expecting `ip' or `ip6'\n", argv[optidx]); + return EXIT_FAILURE; + } + optidx++; + + if (inet_pton(peer_family, argv[optidx++], &sgsn) <= 0) { fprintf(stderr, "bad address for sgsn\n"); exit(EXIT_FAILURE); } - switch (family) { + switch (peer_family) { case AF_INET: gtp_tunnel_set_sgsn_ip4(t, &sgsn.addr); break; -- To view, visit https://gerrit.osmocom.org/c/libgtpnl/+/34739?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libgtpnl Gerrit-Branch: master Gerrit-Change-Id: Ibc581a92a561dc0bd9924d9f15c7a27dc513c8d7 Gerrit-Change-Number: 34739 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in libgtpnl[master]: update to prepare for IPv6 support
by osmith 13 Oct '23

13 Oct '23
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/libgtpnl/+/34734?usp=email ) Change subject: update to prepare for IPv6 support ...................................................................... update to prepare for IPv6 support Change-Id: Ifc7e3b03a723fb544d1c7b789101102b2c27b60e --- M src/gtp-genl.c M src/gtp.c M src/internal.h 3 files changed, 34 insertions(+), 17 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libgtpnl refs/changes/34/34734/1 diff --git a/src/gtp-genl.c b/src/gtp-genl.c index b8edc72..21297b7 100644 --- a/src/gtp-genl.c +++ b/src/gtp-genl.c @@ -48,10 +48,10 @@ if (t->ifns >= 0) mnl_attr_put_u32(nlh, GTPA_NET_NS_FD, t->ifns); mnl_attr_put_u32(nlh, GTPA_LINK, t->ifidx); - if (t->sgsn_addr.s_addr) - mnl_attr_put_u32(nlh, GTPA_PEER_ADDRESS, t->sgsn_addr.s_addr); - if (t->ms_addr.s_addr) - mnl_attr_put_u32(nlh, GTPA_MS_ADDRESS, t->ms_addr.s_addr); + if (t->ip.sgsn_addr.s_addr) + mnl_attr_put_u32(nlh, GTPA_PEER_ADDRESS, t->ip.sgsn_addr.s_addr); + if (t->ip.ms_addr.s_addr) + mnl_attr_put_u32(nlh, GTPA_MS_ADDRESS, t->ip.ms_addr.s_addr); if (t->gtp_version == GTP_V0) { mnl_attr_put_u64(nlh, GTPA_TID, t->u.v0.tid); mnl_attr_put_u16(nlh, GTPA_FLOW, t->u.v0.flowid); @@ -116,8 +116,12 @@ uint32_t o_tei; } v1; } u; - struct in_addr sgsn_addr; - struct in_addr ms_addr; + union { + struct { + struct in_addr sgsn_addr; + struct in_addr ms_addr; + } ip; + }; }; static int genl_gtp_validate_cb(const struct nlattr *attr, void *data) @@ -167,11 +171,11 @@ if (tb[GTPA_O_TEI]) pdp.u.v1.o_tei = mnl_attr_get_u32(tb[GTPA_O_TEI]); if (tb[GTPA_PEER_ADDRESS]) { - pdp.sgsn_addr.s_addr = + pdp.ip.sgsn_addr.s_addr = mnl_attr_get_u32(tb[GTPA_PEER_ADDRESS]); } if (tb[GTPA_MS_ADDRESS]) { - pdp.ms_addr.s_addr = mnl_attr_get_u32(tb[GTPA_MS_ADDRESS]); + pdp.ip.ms_addr.s_addr = mnl_attr_get_u32(tb[GTPA_MS_ADDRESS]); } if (tb[GTPA_VERSION]) { pdp.version = mnl_attr_get_u32(tb[GTPA_VERSION]); @@ -179,15 +183,15 @@ printf("version %u ", pdp.version); if (pdp.version == GTP_V0) { - inet_ntop(AF_INET, &pdp.ms_addr, buf, sizeof(buf)); + inet_ntop(AF_INET, &pdp.ip.ms_addr, buf, sizeof(buf)); printf("tid %"PRIu64" ms_addr %s ", pdp.u.v0.tid, buf); } else if (pdp.version == GTP_V1) { - inet_ntop(AF_INET, &pdp.ms_addr, buf, sizeof(buf)); + inet_ntop(AF_INET, &pdp.ip.ms_addr, buf, sizeof(buf)); printf("tei %u/%u ms_addr %s ", pdp.u.v1.i_tei, pdp.u.v1.o_tei, buf); } - inet_ntop(AF_INET, &pdp.sgsn_addr, buf, sizeof(buf)); + inet_ntop(AF_INET, &pdp.ip.sgsn_addr, buf, sizeof(buf)); printf("sgsn_addr %s\n", buf); return MNL_CB_OK; diff --git a/src/gtp.c b/src/gtp.c index e65b0b6..12f4abe 100644 --- a/src/gtp.c +++ b/src/gtp.c @@ -60,13 +60,13 @@ void gtp_tunnel_set_ms_ip4(struct gtp_tunnel *t, struct in_addr *ms_addr) { - t->ms_addr = *ms_addr; + t->ip.ms_addr = *ms_addr; } EXPORT_SYMBOL(gtp_tunnel_set_ms_ip4); void gtp_tunnel_set_sgsn_ip4(struct gtp_tunnel *t, struct in_addr *sgsn_addr) { - t->sgsn_addr = *sgsn_addr; + t->ip.sgsn_addr = *sgsn_addr; } EXPORT_SYMBOL(gtp_tunnel_set_sgsn_ip4); @@ -114,13 +114,13 @@ const struct in_addr *gtp_tunnel_get_ms_ip4(struct gtp_tunnel *t) { - return &t->ms_addr; + return &t->ip.ms_addr; } EXPORT_SYMBOL(gtp_tunnel_get_ms_ip4); const struct in_addr *gtp_tunnel_get_sgsn_ip4(struct gtp_tunnel *t) { - return &t->sgsn_addr; + return &t->ip.sgsn_addr; } EXPORT_SYMBOL(gtp_tunnel_get_sgsn_ip4); diff --git a/src/internal.h b/src/internal.h index 1754e3b..559461f 100644 --- a/src/internal.h +++ b/src/internal.h @@ -15,8 +15,12 @@ struct gtp_tunnel { int ifns; uint32_t ifidx; - struct in_addr ms_addr; - struct in_addr sgsn_addr; + union { + struct { + struct in_addr ms_addr; + struct in_addr sgsn_addr; + } ip; + }; int gtp_version; union { struct { -- To view, visit https://gerrit.osmocom.org/c/libgtpnl/+/34734?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libgtpnl Gerrit-Branch: master Gerrit-Change-Id: Ifc7e3b03a723fb544d1c7b789101102b2c27b60e Gerrit-Change-Number: 34734 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in libgtpnl[master]: add IPv6 support
by osmith 13 Oct '23

13 Oct '23
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/libgtpnl/+/34735?usp=email ) Change subject: add IPv6 support ...................................................................... add IPv6 support Changes made by Oliver: - set t->family = AF_INET in gtp_tunnel_alloc for backwards compatibility with older osmo-ggsn versions that don't explicitly set it. - cosmetics Change-Id: If864c9170f74af52a95cbc4cdb1b866e0309306b --- M include/linux/gtp.h M src/gtp-genl.c M src/gtp.c M src/internal.h 4 files changed, 105 insertions(+), 25 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libgtpnl refs/changes/35/34735/1 diff --git a/include/linux/gtp.h b/include/linux/gtp.h index c525cb3..c2ecec2 100644 --- a/include/linux/gtp.h +++ b/include/linux/gtp.h @@ -1,10 +1,14 @@ -#ifndef _UAPI_LINUX_GTP_H_ -#define _UAPI_LINUX_GTP_H__ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __LINUX_GTP_H_ +#define __LINUX_GTP_H_ + +#define GTP_GENL_MCGRP_NAME "gtp" enum gtp_genl_cmds { GTP_CMD_NEWPDP, GTP_CMD_DELPDP, GTP_CMD_GETPDP, + GTP_CMD_ECHOREQ, GTP_CMD_MAX, }; @@ -19,15 +23,19 @@ GTPA_LINK, GTPA_VERSION, GTPA_TID, /* for GTPv0 only */ - GTPA_PEER_ADDRESS, + GTPA_PEER_ADDRESS, /* Remote GSN peer, either SGSN or GGSN */ +#define GTPA_SGSN_ADDRESS GTPA_PEER_ADDRESS /* maintain legacy attr name */ GTPA_MS_ADDRESS, GTPA_FLOW, GTPA_NET_NS_FD, GTPA_I_TEI, /* for GTPv1 only */ GTPA_O_TEI, /* for GTPv1 only */ GTPA_PAD, + GTPA_PEER_ADDR6, /* Remote GSN peer, either SGSN or GGSN */ + GTPA_MS_ADDR6, + GTPA_FAMILY, __GTPA_MAX, }; #define GTPA_MAX (__GTPA_MAX + 1) -#endif /* _UAPI_LINUX_GTP_H_ */ +#endif /* __LINUX_GTP_H_ */ diff --git a/src/gtp-genl.c b/src/gtp-genl.c index 21297b7..0c90894 100644 --- a/src/gtp-genl.c +++ b/src/gtp-genl.c @@ -44,14 +44,23 @@ static void gtp_build_payload(struct nlmsghdr *nlh, struct gtp_tunnel *t) { + mnl_attr_put_u8(nlh, GTPA_FAMILY, t->family); mnl_attr_put_u32(nlh, GTPA_VERSION, t->gtp_version); if (t->ifns >= 0) mnl_attr_put_u32(nlh, GTPA_NET_NS_FD, t->ifns); mnl_attr_put_u32(nlh, GTPA_LINK, t->ifidx); - if (t->ip.sgsn_addr.s_addr) - mnl_attr_put_u32(nlh, GTPA_PEER_ADDRESS, t->ip.sgsn_addr.s_addr); - if (t->ip.ms_addr.s_addr) - mnl_attr_put_u32(nlh, GTPA_MS_ADDRESS, t->ip.ms_addr.s_addr); + switch (t->family) { + case AF_INET: + if (t->ip.sgsn_addr.s_addr) + mnl_attr_put_u32(nlh, GTPA_PEER_ADDRESS, t->ip.sgsn_addr.s_addr); + if (t->ip.ms_addr.s_addr) + mnl_attr_put_u32(nlh, GTPA_MS_ADDRESS, t->ip.ms_addr.s_addr); + break; + case AF_INET6: + mnl_attr_put(nlh, GTPA_PEER_ADDR6, sizeof(t->ip6.sgsn_addr), &t->ip6.sgsn_addr); + mnl_attr_put(nlh, GTPA_MS_ADDR6, sizeof(t->ip6.ms_addr), &t->ip6.ms_addr); + break; + } if (t->gtp_version == GTP_V0) { mnl_attr_put_u64(nlh, GTPA_TID, t->u.v0.tid); mnl_attr_put_u16(nlh, GTPA_FLOW, t->u.v0.flowid); @@ -106,6 +115,7 @@ EXPORT_SYMBOL(gtp_del_tunnel); struct gtp_pdp { + int family; uint32_t version; union { struct { @@ -121,6 +131,10 @@ struct in_addr sgsn_addr; struct in_addr ms_addr; } ip; + struct { + struct in6_addr sgsn_addr; + struct in6_addr ms_addr; + } ip6; }; }; @@ -133,6 +147,12 @@ return MNL_CB_OK; switch(type) { + case GTPA_FAMILY: + if (mnl_attr_validate(attr, MNL_TYPE_U8) < 0) { + perror("mnl_attr_validate"); + return MNL_CB_ERROR; + } + break; case GTPA_TID: if (mnl_attr_validate(attr, MNL_TYPE_U64) < 0) { perror("mnl_attr_validate"); @@ -149,6 +169,14 @@ return MNL_CB_ERROR; } break; + case GTPA_PEER_ADDR6: + case GTPA_MS_ADDR6: + if (mnl_attr_validate2(attr, MNL_TYPE_BINARY, + sizeof(struct in6_addr)) < 0) { + perror("mnl_attr_validate"); + return MNL_CB_ERROR; + } + break; default: break; } @@ -164,35 +192,58 @@ struct genlmsghdr *genl; mnl_attr_parse(nlh, sizeof(*genl), genl_gtp_validate_cb, tb); + if (tb[GTPA_FAMILY]) + pdp.family = mnl_attr_get_u32(tb[GTPA_FAMILY]); + else + pdp.family = AF_INET; + if (tb[GTPA_TID]) pdp.u.v0.tid = mnl_attr_get_u64(tb[GTPA_TID]); if (tb[GTPA_I_TEI]) pdp.u.v1.i_tei = mnl_attr_get_u32(tb[GTPA_I_TEI]); if (tb[GTPA_O_TEI]) pdp.u.v1.o_tei = mnl_attr_get_u32(tb[GTPA_O_TEI]); - if (tb[GTPA_PEER_ADDRESS]) { - pdp.ip.sgsn_addr.s_addr = - mnl_attr_get_u32(tb[GTPA_PEER_ADDRESS]); + + switch (pdp.family) { + case AF_INET: + if (tb[GTPA_PEER_ADDRESS]) + pdp.ip.sgsn_addr.s_addr = mnl_attr_get_u32(tb[GTPA_PEER_ADDRESS]); + if (tb[GTPA_MS_ADDRESS]) + pdp.ip.ms_addr.s_addr = mnl_attr_get_u32(tb[GTPA_MS_ADDRESS]); + break; + case AF_INET6: + if (tb[GTPA_PEER_ADDR6]) + memcpy(&pdp.ip6.sgsn_addr, mnl_attr_get_payload(tb[GTPA_PEER_ADDR6]), sizeof(struct in6_addr)); + if (tb[GTPA_MS_ADDR6]) + memcpy(&pdp.ip6.ms_addr, mnl_attr_get_payload(tb[GTPA_MS_ADDR6]), sizeof(struct in6_addr)); + break; } - if (tb[GTPA_MS_ADDRESS]) { - pdp.ip.ms_addr.s_addr = mnl_attr_get_u32(tb[GTPA_MS_ADDRESS]); - } - if (tb[GTPA_VERSION]) { + if (tb[GTPA_VERSION]) pdp.version = mnl_attr_get_u32(tb[GTPA_VERSION]); - } printf("version %u ", pdp.version); - if (pdp.version == GTP_V0) { + + if (pdp.version == GTP_V0) + printf("tid %"PRIu64" ", pdp.u.v0.tid); + else if (pdp.version == GTP_V1) + printf("tei %u/%u ", pdp.u.v1.i_tei, pdp.u.v1.o_tei); + + printf("family %s ", pdp.family == AF_INET6 ? "ip6" : "ip"); + + switch (pdp.family) { + case AF_INET: inet_ntop(AF_INET, &pdp.ip.ms_addr, buf, sizeof(buf)); - printf("tid %"PRIu64" ms_addr %s ", - pdp.u.v0.tid, buf); - } else if (pdp.version == GTP_V1) { - inet_ntop(AF_INET, &pdp.ip.ms_addr, buf, sizeof(buf)); - printf("tei %u/%u ms_addr %s ", pdp.u.v1.i_tei, - pdp.u.v1.o_tei, buf); + printf("ms_addr %s ", buf); + inet_ntop(AF_INET, &pdp.ip.sgsn_addr, buf, sizeof(buf)); + printf("sgsn_addr %s\n", buf); + break; + case AF_INET6: + inet_ntop(AF_INET6, &pdp.ip6.ms_addr, buf, sizeof(buf)); + printf("ms_addr6 %s ", buf); + inet_ntop(AF_INET6, &pdp.ip6.sgsn_addr, buf, sizeof(buf)); + printf("sgsn_addr6 %s\n", buf); + break; } - inet_ntop(AF_INET, &pdp.ip.sgsn_addr, buf, sizeof(buf)); - printf("sgsn_addr %s\n", buf); return MNL_CB_OK; } diff --git a/src/gtp.c b/src/gtp.c index 12f4abe..05e3731 100644 --- a/src/gtp.c +++ b/src/gtp.c @@ -36,6 +36,7 @@ return NULL; t->ifns = -1; + t->family = AF_INET; return t; } EXPORT_SYMBOL(gtp_tunnel_alloc); diff --git a/src/internal.h b/src/internal.h index 559461f..8e8b3c5 100644 --- a/src/internal.h +++ b/src/internal.h @@ -13,6 +13,7 @@ #include <netinet/in.h> struct gtp_tunnel { + uint8_t family; int ifns; uint32_t ifidx; union { @@ -20,6 +21,10 @@ struct in_addr ms_addr; struct in_addr sgsn_addr; } ip; + struct { + struct in6_addr ms_addr; + struct in6_addr sgsn_addr; + } ip6; }; int gtp_version; union { -- To view, visit https://gerrit.osmocom.org/c/libgtpnl/+/34735?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libgtpnl Gerrit-Branch: master Gerrit-Change-Id: If864c9170f74af52a95cbc4cdb1b866e0309306b Gerrit-Change-Number: 34735 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in libgtpnl[master]: add IPv6 API for GTP tunnel
by osmith 13 Oct '23

13 Oct '23
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/libgtpnl/+/34736?usp=email ) Change subject: add IPv6 API for GTP tunnel ...................................................................... add IPv6 API for GTP tunnel Extend existing API to allow to set family and IPv6 ms and sgsn address. Change-Id: Ic9c1a5cd791b285d214e7f2aeb76f8bf372e01c6 --- M include/libgtpnl/gtp.h M src/gtp.c M src/libgtpnl.map 3 files changed, 38 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libgtpnl refs/changes/36/34736/1 diff --git a/include/libgtpnl/gtp.h b/include/libgtpnl/gtp.h index a6cd8e2..b7b582b 100644 --- a/include/libgtpnl/gtp.h +++ b/include/libgtpnl/gtp.h @@ -9,10 +9,13 @@ 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); diff --git a/src/gtp.c b/src/gtp.c index 05e3731..9952278 100644 --- a/src/gtp.c +++ b/src/gtp.c @@ -47,6 +47,12 @@ } 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; @@ -71,6 +77,18 @@ } 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; diff --git a/src/libgtpnl.map b/src/libgtpnl.map index 804f8b3..cfb1b20 100644 --- a/src/libgtpnl.map +++ b/src/libgtpnl.map @@ -38,3 +38,9 @@ local: *; }; + +LIBGTPNL_1.1 { + gtp_tunnel_set_family; + gtp_tunnel_set_ms_ip6; + gtp_tunnel_set_sgsn_ip6; +} LIBGTPNL_1.0; -- To view, visit https://gerrit.osmocom.org/c/libgtpnl/+/34736?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libgtpnl Gerrit-Branch: master Gerrit-Change-Id: Ic9c1a5cd791b285d214e7f2aeb76f8bf372e01c6 Gerrit-Change-Number: 34736 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmocom-bb[master]: layer23: send UL/DL GPRS blocks over GSMTAP
by fixeria 13 Oct '23

13 Oct '23
fixeria has uploaded a new patch set (#2). ( https://gerrit.osmocom.org/c/osmocom-bb/+/34733?usp=email ) Change subject: layer23: send UL/DL GPRS blocks over GSMTAP ...................................................................... layer23: send UL/DL GPRS blocks over GSMTAP Note that despite the VTY interface offers various channel type filtering facilities, the actual filtering is not implemented. This patch simply brings PS domain in consistency with CS domain: the UL and DL GPRS blocks are now being sent over GSMTAP without any filtering, just like GSM MAC blocks. Change-Id: I338205bee44fe182233efc5619a3d528cd07d932 Related: OS#5500, OS#6209 --- M src/host/layer23/src/common/l1ctl.c 1 file changed, 37 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/33/34733/2 -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/34733?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I338205bee44fe182233efc5619a3d528cd07d932 Gerrit-Change-Number: 34733 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-MessageType: newpatchset
1 0
0 0
[S] Change in osmocom-bb[master]: layer23: send GPRS BLOCK.{ind,req} over GSMTAP
by fixeria 13 Oct '23

13 Oct '23
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/34733?usp=email ) Change subject: layer23: send GPRS BLOCK.{ind,req} over GSMTAP ...................................................................... layer23: send GPRS BLOCK.{ind,req} over GSMTAP Note that despite the VTY interface offers various channel type filtering facilities, the actual filtering is not implemented. This patch simply brings PS domain in consistency with CS domain: the UL and DL GPRS blocks are now being sent over GSMTAP without any filtering, just like GSM MAC blocks. Change-Id: I338205bee44fe182233efc5619a3d528cd07d932 Related: OS#5500, OS#6209 --- M src/host/layer23/src/common/l1ctl.c 1 file changed, 37 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/33/34733/1 diff --git a/src/host/layer23/src/common/l1ctl.c b/src/host/layer23/src/common/l1ctl.c index 589af09..c4589f0 100644 --- a/src/host/layer23/src/common/l1ctl.c +++ b/src/host/layer23/src/common/l1ctl.c @@ -961,6 +961,8 @@ static int rx_l1_gprs_dl_block_ind(struct osmocom_ms *ms, struct msgb *msg) { const struct l1ctl_gprs_dl_block_ind *ind = (void *)msg->l1h; + uint8_t gsmtap_chan; + uint32_t fn; if (msgb_l1len(msg) < sizeof(*ind)) { LOGP(DL1C, LOGL_ERROR, @@ -977,8 +979,20 @@ msg->l2h = (void *)&ind->data[0]; + fn = ntohl(ind->hdr.fn); + if ((fn % 104) == 12) + gsmtap_chan = GSMTAP_CHANNEL_PTCCH; + else + gsmtap_chan = GSMTAP_CHANNEL_PDTCH; + + gsmtap_send(l23_cfg.gsmtap.inst, + ms->rrlayer.cd_now.arfcn, + ind->hdr.tn, gsmtap_chan, 0, fn, + rxlev2dbm(ind->meas.rx_lev), 0, + msgb_l2(msg), msgb_l2len(msg)); + DEBUGP(DL1C, "Rx GPRS DL block (fn=%u, tn=%u, len=%u): %s\n", - ntohl(ind->hdr.fn), ind->hdr.tn, msgb_l2len(msg), msgb_hexdump_l2(msg)); + fn, ind->hdr.tn, msgb_l2len(msg), msgb_hexdump_l2(msg)); /* distribute or drop */ if (ms->l1_entity.l1_gprs_dl_block_ind) @@ -1037,6 +1051,11 @@ DEBUGP(DL1C, "Tx GPRS UL block (fn=%u, tn=%u, len=%zu): %s\n", fn, tn, data_len, osmo_hexdump(data, data_len)); + gsmtap_send(l23_cfg.gsmtap.inst, + ms->rrlayer.cd_now.arfcn | GSMTAP_ARFCN_F_UPLINK, + tn, GSMTAP_CHANNEL_PDTCH, 0, fn, 127, 0, + data, data_len); + return osmo_send_l1(ms, msg); } -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/34733?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I338205bee44fe182233efc5619a3d528cd07d932 Gerrit-Change-Number: 34733 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in docker-playground[master]: common/ttcn3-docker-run.sh: add TEST_NAME env var
by osmith 13 Oct '23

13 Oct '23
Attention is currently required from: pespin. osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/docker-playground/+/34732?usp=email ) Change subject: common/ttcn3-docker-run.sh: add TEST_NAME env var ...................................................................... Patch Set 1: (1 comment) Patchset: PS1: I used to do that as well, but this patch simplifies my workflow a lot. Now I can just do: > t3 -k -t TC_pdp4_act_deact ggsn (To run the GGSN testsuite with a custom kernel tree in qemu, with this specific test, all components (osmo-ggsn, libgtpnl, other depends, testsuite, and kernel) built from source.) -- To view, visit https://gerrit.osmocom.org/c/docker-playground/+/34732?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: docker-playground Gerrit-Branch: master Gerrit-Change-Id: I1f45a05e089b429918096fcd64f7c02033d5a9dd Gerrit-Change-Number: 34732 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Fri, 13 Oct 2023 10:55:30 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
[S] Change in docker-playground[master]: common/ttcn3-docker-run.sh: add TEST_NAME env var
by pespin 13 Oct '23

13 Oct '23
Attention is currently required from: osmith. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/docker-playground/+/34732?usp=email ) Change subject: common/ttcn3-docker-run.sh: add TEST_NAME env var ...................................................................... Patch Set 1: Code-Review+1 (1 comment) Patchset: PS1: I simply update the .cfg file to list the tests I want to run, but if that works for you too, then we can add it. -- To view, visit https://gerrit.osmocom.org/c/docker-playground/+/34732?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: docker-playground Gerrit-Branch: master Gerrit-Change-Id: I1f45a05e089b429918096fcd64f7c02033d5a9dd Gerrit-Change-Number: 34732 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Comment-Date: Fri, 13 Oct 2023 10:51:50 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • ...
  • 185
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.