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

March 2026

  • 1 participants
  • 1933 discussions
[XS] Change in osmo-ttcn3-hacks[master]: 5gc: Remove arleady tested TODO
by pespin 24 Mar '26

24 Mar '26
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42480?usp=email ) Change subject: 5gc: Remove arleady tested TODO ...................................................................... 5gc: Remove arleady tested TODO PDU Sess Est Req with emeregency services is already tested in test TC_normal_reg_emergency_services. Change-Id: I5e2d202ffd019b22a006637534922e0ba1d09ca0 --- M 5gc/C5G_Tests.ttcn 1 file changed, 0 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/80/42480/1 diff --git a/5gc/C5G_Tests.ttcn b/5gc/C5G_Tests.ttcn index b80034f..0636bd0 100644 --- a/5gc/C5G_Tests.ttcn +++ b/5gc/C5G_Tests.ttcn @@ -1137,7 +1137,6 @@ * - 3GPP TS 23.632 5.2.3 Vector Generation in UDM/ARPF: Not supported by open5gs (missing Nudm_UEAuthentication_GetHssAv in UDM) * - 3GPP TS 23.502 Annex G (normative): Support of GERAN/UTRAN access by SMF+PGW-C: Not supported by open5gs (Gn<->N7 (to PCF) in open5gs-smfd) * - * - Emergency call (PDU Sess Establish "Request Type"="Emergency Request") * - VoLTE: * -- " If the UE requested P-CSCF discovery then the message shall also include the P-CSCF IP address(es) as determined by the SMF and as described in clause 5.16.3.4 of TS 23.50" * - Fill in PCO during PDU Sess Establish Req. -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42480?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I5e2d202ffd019b22a006637534922e0ba1d09ca0 Gerrit-Change-Number: 42480 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: 5gc: Introduce test TC_pdu_sess_est_always_on
by pespin 24 Mar '26

24 Mar '26
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42478?usp=email to look at the new patch set (#3). The following approvals got outdated and were removed: Verified+1 by Jenkins Builder Change subject: 5gc: Introduce test TC_pdu_sess_est_always_on ...................................................................... 5gc: Introduce test TC_pdu_sess_est_always_on This feature is right now not implemented in open5gs and hence the test is expected to fail, since it returns no AlwaysOn Indication in PDU Session Establishment Accept. Change-Id: I282e0c8072172fa633bf82ed6b9492b0bb4362cc --- M 5gc/C5G_Tests.ttcn M 5gc/ConnHdlr.ttcn M 5gc/expected-results.xml 3 files changed, 49 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/78/42478/3 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42478?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I282e0c8072172fa633bf82ed6b9492b0bb4362cc Gerrit-Change-Number: 42478 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder
1 0
0 0
[XS] Change in osmo-gsm-tester[master]: contrib/jenkins-build-osmo-ggsn.sh: Depend on libosmo-netif
by pespin 24 Mar '26

24 Mar '26
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/42479?usp=email ) Change subject: contrib/jenkins-build-osmo-ggsn.sh: Depend on libosmo-netif ...................................................................... contrib/jenkins-build-osmo-ggsn.sh: Depend on libosmo-netif Since osmo-ggsn.git Change-Id I8d8fae362f302d48afaed28a9c664f76ca4a2739, osmo-ggsn depends on libosmo-netif. Change-Id: I72dfdd937cfc34fce1137515e6f4828807c40b08 --- M contrib/jenkins-build-osmo-ggsn.sh 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/79/42479/1 diff --git a/contrib/jenkins-build-osmo-ggsn.sh b/contrib/jenkins-build-osmo-ggsn.sh index d727eab..c07e4c5 100755 --- a/contrib/jenkins-build-osmo-ggsn.sh +++ b/contrib/jenkins-build-osmo-ggsn.sh @@ -5,6 +5,7 @@ . "$(dirname "$0")/jenkins-build-common.sh" build_repo libosmocore ${SANITIZE_FLAGS} --disable-doxygen --disable-uring +build_repo libosmo-netif ${SANITIZE_FLAGS} --disable-doxygen build_repo osmo-ggsn ${SANITIZE_FLAGS} create_bin_tgz osmo-ggsn -- To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/42479?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-gsm-tester Gerrit-Branch: master Gerrit-Change-Id: I72dfdd937cfc34fce1137515e6f4828807c40b08 Gerrit-Change-Number: 42479 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: 5gc: Introduce test TC_pdu_sess_est_always_on
by pespin 24 Mar '26

24 Mar '26
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42478?usp=email to look at the new patch set (#2). Change subject: 5gc: Introduce test TC_pdu_sess_est_always_on ...................................................................... 5gc: Introduce test TC_pdu_sess_est_always_on This feature is right now not implemented in open5gs and hence the test is expected to fail, since it returns no AlwaysOn Indication in PDU Session Establishment Accept. Change-Id: I282e0c8072172fa633bf82ed6b9492b0bb4362cc --- M 5gc/C5G_Tests.ttcn M 5gc/ConnHdlr.ttcn M 5gc/expected-results.xml 3 files changed, 49 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/78/42478/2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42478?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I282e0c8072172fa633bf82ed6b9492b0bb4362cc Gerrit-Change-Number: 42478 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder
1 0
0 0
[L] Change in osmo-ggsn[master]: Depend on libosmo-netif for icmpv6 APIs
by pespin 24 Mar '26

24 Mar '26
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/42465?usp=email ) Change subject: Depend on libosmo-netif for icmpv6 APIs ...................................................................... Depend on libosmo-netif for icmpv6 APIs Most of icmpv6.* and checksum.* was moved to libosmo-netif from this same repository so it can be reused. Link to libosmo-netif and adapt code to new public symbol naming. Depends: libosmo-netif.git Change-Id I78ec7270c717af0a1b8ffd9398cd69ea7a0dbee2 Change-Id: I8d8fae362f302d48afaed28a9c664f76ca4a2739 --- M TODO-RELEASE M configure.ac M contrib/jenkins.sh M debian/control M ggsn/Makefile.am M ggsn/ggsn.c M lib/Makefile.am D lib/checksum.c D lib/checksum.h M lib/icmpv6.c M lib/icmpv6.h M sgsnemu/Makefile.am M sgsnemu/sgsnemu.c 13 files changed, 55 insertions(+), 538 deletions(-) Approvals: pespin: Looks good to me, approved fixeria: Looks good to me, but someone else must approve osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/TODO-RELEASE b/TODO-RELEASE index 0ed7189..aab5c0a 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -7,3 +7,4 @@ # If any interfaces have been added since the last public release: c:r:a + 1. # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line +libosmo-netif >1.7.0 osmo_icmpv6_*() diff --git a/configure.ac b/configure.ac index ade3ae9..2fd4d36 100644 --- a/configure.ac +++ b/configure.ac @@ -158,6 +158,7 @@ PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.12.0) PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.12.0) PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.12.0) +PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 1.7.0) AC_ARG_ENABLE(sanitize, [AS_HELP_STRING( diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 4404cfa..9f643da 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -24,17 +24,18 @@ mkdir "$deps" || true -if [ "x$GTP" == "x--enable-gtp-linux" ]; then - osmo-build-dep.sh libgtpnl -fi -osmo-build-dep.sh libosmocore "" --disable-doxygen - verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]") export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" export LD_LIBRARY_PATH="$inst/lib" export PATH="$inst/bin:$PATH" +if [ "x$GTP" == "x--enable-gtp-linux" ]; then + osmo-build-dep.sh libgtpnl +fi +osmo-build-dep.sh libosmocore "" --disable-doxygen +osmo-build-dep.sh libosmo-netif "" --disable-doxygen + # Additional configure options and depends CONFIG="" if [ "$WITH_MANUALS" = "1" ]; then diff --git a/debian/control b/debian/control index 8c9237d..0bd4694 100644 --- a/debian/control +++ b/debian/control @@ -8,6 +8,7 @@ libdpkg-perl, git, dh-autoreconf, libosmocore-dev (>= 1.12.0), + libosmo-netif-dev (>= 1.7.0), osmo-gsm-manuals-dev (>= 1.7.0), libgtpnl-dev (>= 1.3.0) Standards-Version: 3.9.6 diff --git a/ggsn/Makefile.am b/ggsn/Makefile.am index ad6b2b2..c82f458 100644 --- a/ggsn/Makefile.am +++ b/ggsn/Makefile.am @@ -11,9 +11,17 @@ $(LIBOSMOCORE_CFLAGS) \ $(LIBOSMOCTRL_CFLAGS) \ $(LIBOSMOVTY_CFLAGS) \ + $(LIBOSMONETIF_CFLAGS) \ $(NULL) -osmo_ggsn_LDADD = @EXEC_LDADD@ -lgtp -L../gtp ../lib/libmisc.a $(LIBOSMOCORE_LIBS) $(LIBOSMOCTRL_LIBS) $(LIBOSMOVTY_LIBS) +osmo_ggsn_LDADD = \ + @EXEC_LDADD@ \ + -lgtp -L../gtp ../lib/libmisc.a \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOCTRL_LIBS) \ + $(LIBOSMOVTY_LIBS) \ + $(LIBOSMONETIF_LIBS) \ + $(NULL) if ENABLE_GTP_KERNEL AM_CFLAGS += -DGTP_KERNEL $(LIBGTPNL_CFLAGS) diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c index 329b15f..3177713 100644 --- a/ggsn/ggsn.c +++ b/ggsn/ggsn.c @@ -46,6 +46,8 @@ #include <osmocom/ctrl/control_if.h> #include <osmocom/gsm/apn.h> +#include <osmocom/netif/icmpv6.h> + #include <osmocom/gtp/pdp.h> #include <osmocom/gtp/gtp.h> @@ -789,11 +791,13 @@ if (IN6_IS_ADDR_MULTICAST(&ip6h->ip6_dst)) { /* daddr: all-routers multicast addr */ - if (IN6_ARE_ADDR_EQUAL(&ip6h->ip6_dst, &all_router_mcast_addr)) + if (IN6_ARE_ADDR_EQUAL(&ip6h->ip6_dst, &osmo_icmpv6_all_router_mcast_addr)) return handle_router_mcast(pdp->gsn, pdp, &peer->addr.v6, &apn->v6_lladdr, apn->cfg.mtu, pack, len); /* daddr: solicited-node multicast addr */ - if (memcmp(&ip6h->ip6_dst.s6_addr, solicited_node_mcast_addr_prefix, sizeof(solicited_node_mcast_addr_prefix)) == 0) + if (memcmp(&ip6h->ip6_dst.s6_addr, + osmo_icmpv6_solicited_node_mcast_addr_prefix, + sizeof(osmo_icmpv6_solicited_node_mcast_addr_prefix)) == 0) return handle_solicited_node_mcast(pack, len); } break; diff --git a/lib/Makefile.am b/lib/Makefile.am index 1fdc93f..7f0f14f 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,7 +1,6 @@ noinst_LIBRARIES = libmisc.a noinst_HEADERS = \ - checksum.h \ gnugetopt.h \ gtp-kernel.h \ icmpv6.h \ @@ -21,10 +20,10 @@ -DSBINDIR='"$(sbindir)"' \ -I$(top_srcdir)/include \ $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMONETIF_CFLAGS) \ $(NULL) libmisc_a_SOURCES = \ - checksum.c \ debug.c \ getopt.c \ getopt1.c \ diff --git a/lib/checksum.c b/lib/checksum.c deleted file mode 100644 index 4b23897..0000000 --- a/lib/checksum.c +++ /dev/null @@ -1,211 +0,0 @@ -/* - * - * INET An implementation of the TCP/IP protocol suite for the LINUX - * operating system. INET is implemented using the BSD Socket - * interface as the means of communication with the user level. - * - * IP/TCP/UDP checksumming routines - * - * Authors: Jorge Cwik, <jorge(a)laser.satlink.net> - * Arnt Gulbrandsen, <agulbra(a)nvg.unit.no> - * Tom May, <ftom(a)netcom.com> - * Andreas Schwab, <schwab(a)issan.informatik.uni-dortmund.de> - * Lots of code moved from tcp.c and ip.c; see those files - * for more names. - * - * 03/02/96 Jes Sorensen, Andreas Schwab, Roman Hodek: - * Fixed some nasty bugs, causing some horrible crashes. - * A: At some points, the sum (%0) was used as - * length-counter instead of the length counter - * (%1). Thanks to Roman Hodek for pointing this out. - * B: GCC seems to mess up if one uses too many - * data-registers to hold input values and one tries to - * specify d0 and d1 as scratch registers. Letting gcc - * choose these registers itself solves the problem. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -/* Revised by Kenneth Albanowski for m68knommu. Basic problem: unaligned access - kills, so most of the assembly has to go. */ - -#if defined(__FreeBSD__) -#define _KERNEL /* needed on FreeBSD 10.x for s6_addr32 */ -#include <sys/types.h> -#include <netinet/in.h> -#include <sys/endian.h> -#endif - -#include "checksum.h" -#include <arpa/inet.h> - -static inline unsigned short from32to16(unsigned int x) -{ - /* add up 16-bit and 16-bit for 16+c bit */ - x = (x & 0xffff) + (x >> 16); - /* add up carry.. */ - x = (x & 0xffff) + (x >> 16); - return x; -} - -static unsigned int do_csum(const unsigned char *buff, int len) -{ - int odd; - unsigned int result = 0; - - if (len <= 0) - goto out; - odd = 1 & (unsigned long) buff; - if (odd) { -#if BYTE_ORDER == LITTLE_ENDIAN - result += (*buff << 8); -#else - result = *buff; -#endif - len--; - buff++; - } - if (len >= 2) { - if (2 & (unsigned long) buff) { - result += *(unsigned short *) buff; - len -= 2; - buff += 2; - } - if (len >= 4) { - const unsigned char *end = buff + ((unsigned)len & ~3); - unsigned int carry = 0; - do { - unsigned int w = *(unsigned int *) buff; - buff += 4; - result += carry; - result += w; - carry = (w > result); - } while (buff < end); - result += carry; - result = (result & 0xffff) + (result >> 16); - } - if (len & 2) { - result += *(unsigned short *) buff; - buff += 2; - } - } - if (len & 1) -#if BYTE_ORDER == LITTLE_ENDIAN - result += *buff; -#else - result += (*buff << 8); -#endif - result = from32to16(result); - if (odd) - result = ((result >> 8) & 0xff) | ((result & 0xff) << 8); -out: - return result; -} - -/* - * This is a version of ip_compute_csum() optimized for IP headers, - * which always checksum on 4 octet boundaries. - */ -uint16_t ip_fast_csum(const void *iph, unsigned int ihl) -{ - return (uint16_t)~do_csum(iph, ihl*4); -} - -/* - * computes the checksum of a memory block at buff, length len, - * and adds in "sum" (32-bit) - * - * returns a 32-bit number suitable for feeding into itself - * or csum_tcpudp_magic - * - * this function must be called with even lengths, except - * for the last fragment, which may be odd - * - * it's best to have buff aligned on a 32-bit boundary - */ -uint32_t csum_partial(const void *buff, int len, uint32_t wsum) -{ - unsigned int sum = (unsigned int)wsum; - unsigned int result = do_csum(buff, len); - - /* add in old sum, and carry.. */ - result += sum; - if (sum > result) - result += 1; - return (uint32_t)result; -} - -/* - * this routine is used for miscellaneous IP-like checksums, mainly - * in icmp.c - */ -uint16_t ip_compute_csum(const void *buff, int len) -{ - return (uint16_t)~do_csum(buff, len); -} - -uint16_t csum_ipv6_magic(const struct in6_addr *saddr, - const struct in6_addr *daddr, - uint32_t len, uint8_t proto, uint32_t csum) -{ - int carry; - uint32_t ulen; - uint32_t uproto; - uint32_t sum = (uint32_t)csum; - - sum += (uint32_t)saddr->s6_addr32[0]; - carry = (sum < (uint32_t)saddr->s6_addr32[0]); - sum += carry; - - sum += (uint32_t)saddr->s6_addr32[1]; - carry = (sum < (uint32_t)saddr->s6_addr32[1]); - sum += carry; - - sum += (uint32_t)saddr->s6_addr32[2]; - carry = (sum < (uint32_t)saddr->s6_addr32[2]); - sum += carry; - - sum += (uint32_t)saddr->s6_addr32[3]; - carry = (sum < (uint32_t)saddr->s6_addr32[3]); - sum += carry; - - sum += (uint32_t)daddr->s6_addr32[0]; - carry = (sum < (uint32_t)daddr->s6_addr32[0]); - sum += carry; - - sum += (uint32_t)daddr->s6_addr32[1]; - carry = (sum < (uint32_t)daddr->s6_addr32[1]); - sum += carry; - - sum += (uint32_t)daddr->s6_addr32[2]; - carry = (sum < (uint32_t)daddr->s6_addr32[2]); - sum += carry; - - sum += (uint32_t)daddr->s6_addr32[3]; - carry = (sum < (uint32_t)daddr->s6_addr32[3]); - sum += carry; - - ulen = (uint32_t)htonl((uint32_t) len); - sum += ulen; - carry = (sum < ulen); - sum += carry; - - uproto = (uint32_t)htonl(proto); - sum += uproto; - carry = (sum < uproto); - sum += carry; - - return csum_fold((uint32_t)sum); -} - -/* fold a partial checksum */ -uint16_t csum_fold(uint32_t csum) -{ - uint32_t sum = (uint32_t)csum; - sum = (sum & 0xffff) + (sum >> 16); - sum = (sum & 0xffff) + (sum >> 16); - return (uint16_t)~sum; -} diff --git a/lib/checksum.h b/lib/checksum.h deleted file mode 100644 index 4b22431..0000000 --- a/lib/checksum.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once -#include <stdint.h> -#include <netinet/in.h> - -uint16_t ip_fast_csum(const void *iph, unsigned int ihl); -uint32_t csum_partial(const void *buff, int len, uint32_t wsum); -uint16_t ip_compute_csum(const void *buff, int len); - -uint16_t csum_ipv6_magic(const struct in6_addr *saddr, - const struct in6_addr *daddr, - uint32_t len, uint8_t proto, uint32_t csum); - -uint16_t csum_fold(uint32_t csum); diff --git a/lib/icmpv6.c b/lib/icmpv6.c index 4226fc0..51a2b81 100644 --- a/lib/icmpv6.c +++ b/lib/icmpv6.c @@ -22,172 +22,16 @@ #include <osmocom/core/msgb.h> #include <osmocom/core/utils.h> +#include <osmocom/netif/icmpv6.h> + #include <osmocom/gtp/gtp.h> #include <osmocom/gtp/pdp.h> -#include "checksum.h" #include "ippool.h" #include "syserr.h" #include "icmpv6.h" #include "config.h" -/* 29.061 11.2.1.3.4 IPv6 Router Configuration Variables in GGSN */ -#define GGSN_MaxRtrAdvInterval 21600 /* 6 hours */ -#define GGSN_MinRtrAdvInterval 16200 /* 4.5 hours */ -#define GGSN_AdvValidLifetime 0xffffffff /* infinite */ -#define GGSN_AdvPreferredLifetime 0xffffffff /* infinite */ - -/* RFC3307 link-local scope multicast address */ -const struct in6_addr all_router_mcast_addr = { - .s6_addr = { 0xff,0x02,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,2 } -}; - -/* RFC4291 link-local solicited-node multicast address, FF02:0:0:0:0:1:FF, 104 bits = 13 bytes */ -const uint8_t solicited_node_mcast_addr_prefix[13] = { - 0xff, 0x02, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, - 0xFF -}; - -/* Prepends the ipv6 header and returns checksum content */ -uint16_t icmpv6_prepend_ip6hdr(struct msgb *msg, const struct in6_addr *saddr, - const struct in6_addr *daddr) -{ - uint32_t len; - uint16_t skb_csum; - struct ip6_hdr *i6h; - - /* checksum */ - skb_csum = csum_partial(msgb_data(msg), msgb_length(msg), 0); - len = msgb_length(msg); - skb_csum = csum_ipv6_magic(saddr, daddr, len, IPPROTO_ICMPV6, skb_csum); - - /* Push IPv6 header in front of ICMPv6 packet */ - i6h = (struct ip6_hdr *) msgb_push(msg, sizeof(*i6h)); - /* 4 bits version, 8 bits TC, 20 bits flow-ID */ - i6h->ip6_ctlun.ip6_un1.ip6_un1_flow = htonl(0x60000000); - i6h->ip6_ctlun.ip6_un1.ip6_un1_plen = htons(len); - i6h->ip6_ctlun.ip6_un1.ip6_un1_nxt = IPPROTO_ICMPV6; - i6h->ip6_ctlun.ip6_un1.ip6_un1_hlim = 255; - i6h->ip6_src = *saddr; - i6h->ip6_dst = *daddr; - return skb_csum; -} - -/*! construct a RFC4861 compliant ICMPv6 router soliciation - * \param[in] saddr Source IPv6 address for router advertisement - * \param[in] daddr Destination IPv6 address for router advertisement IPv6 header - * \param[in] prefix The single prefix to be advertised (/64 implied!) - * \returns callee-allocated message buffer containing router advertisement */ -struct msgb *icmpv6_construct_rs(const struct in6_addr *saddr) -{ - struct msgb *msg = msgb_alloc_headroom(512,128, "IPv6 RS"); - struct icmpv6_rsol_hdr *rs; - OSMO_ASSERT(msg); - rs = (struct icmpv6_rsol_hdr *) msgb_put(msg, sizeof(*rs)); - rs->hdr.type = 133; /* see RFC4861 4.1 */ - rs->hdr.code = 0; /* see RFC4861 4.1 */ - rs->hdr.csum = 0; /* updated below */ - rs->reserved = 0; /* see RFC4861 4.1 */ - - rs->hdr.csum = icmpv6_prepend_ip6hdr(msg, saddr, &all_router_mcast_addr); - - return msg; -} -/*! construct a 3GPP 29.061 compliant router advertisement for a given prefix - * \param[in] saddr Source IPv6 address for router advertisement - * \param[in] daddr Destination IPv6 address for router advertisement IPv6 header - * \param[in] prefix The single prefix to be advertised (/64 implied!) - * \returns callee-allocated message buffer containing router advertisement */ -static struct msgb *icmpv6_construct_ra(const struct in6_addr *saddr, - const struct in6_addr *daddr, - const struct in6_addr *prefix, - uint32_t mtu) -{ - struct msgb *msg = msgb_alloc_headroom(512,128, "IPv6 RA"); - struct icmpv6_radv_hdr *ra; - struct icmpv6_opt_prefix *ra_opt_pref; - struct icmpv6_opt_mtu *ra_opt_mtu; - - OSMO_ASSERT(msg); - - ra = (struct icmpv6_radv_hdr *) msgb_put(msg, sizeof(*ra)); - ra->hdr.type = 134; /* see RFC4861 4.2 */ - ra->hdr.code = 0; /* see RFC4861 4.2 */ - ra->hdr.csum = 0; /* updated below */ - ra->cur_ho_limit = 64; /* seems reasonable? */ - /* the GGSN shall leave the M-flag cleared in the Router - * Advertisement messages */ - ra->m = 0; - /* The GGSN may set the O-flag if there are additional - * configuration parameters that need to be fetched by the MS */ - ra->o = 0; /* no DHCPv6 */ - ra->res = 0; - /* RFC4861 Default: 3 * MaxRtrAdvInterval */ - ra->router_lifetime = htons(3*GGSN_MaxRtrAdvInterval); - ra->reachable_time = 0; /* Unspecified */ - - /* RFC4861 Section 4.6.2 */ - ra_opt_pref = (struct icmpv6_opt_prefix *) msgb_put(msg, sizeof(*ra_opt_pref)); - ra_opt_pref->hdr.type = 3; /* RFC4861 4.6.2 */ - ra_opt_pref->hdr.len = 4; /* RFC4861 4.6.2 */ - ra_opt_pref->prefix_len = 64; /* only prefix length as per 3GPP */ - /* The Prefix is contained in the Prefix Information Option of - * the Router Advertisements and shall have the A-flag set - * and the L-flag cleared */ - ra_opt_pref->a = 1; - ra_opt_pref->l = 0; - ra_opt_pref->res = 0; - /* The lifetime of the prefix shall be set to infinity */ - ra_opt_pref->valid_lifetime = htonl(GGSN_AdvValidLifetime); - ra_opt_pref->preferred_lifetime = htonl(GGSN_AdvPreferredLifetime); - ra_opt_pref->res2 = 0; - memcpy(ra_opt_pref->prefix, prefix, sizeof(ra_opt_pref->prefix)); - - /* RFC4861 Section 4.6.4, MTU */ - ra_opt_mtu = (struct icmpv6_opt_mtu *) msgb_put(msg, sizeof(*ra_opt_mtu)); - ra_opt_mtu->hdr.type = 5; /* RFC4861 4.6.4 */ - ra_opt_mtu->hdr.len = 1; /* RFC4861 4.6.4 */ - ra_opt_mtu->reserved = 0; - ra_opt_mtu->mtu = htonl(mtu); - - /* The Prefix is contained in the Prefix Information Option of - * the Router Advertisements and shall have the A-flag set - * and the L-flag cleared */ - ra_opt_pref->a = 1; - ra_opt_pref->l = 0; - ra_opt_pref->res = 0; - /* The lifetime of the prefix shall be set to infinity */ - ra_opt_pref->valid_lifetime = htonl(GGSN_AdvValidLifetime); - ra_opt_pref->preferred_lifetime = htonl(GGSN_AdvPreferredLifetime); - ra_opt_pref->res2 = 0; - memcpy(ra_opt_pref->prefix, prefix, sizeof(ra_opt_pref->prefix)); - - /* checksum */ - ra->hdr.csum = icmpv6_prepend_ip6hdr(msg, saddr, daddr); - - return msg; -} - -/* Validate an ICMPv6 router solicitation according to RFC4861 6.1.1 */ -static bool icmpv6_validate_router_solicit(const uint8_t *pack, unsigned len) -{ - const struct ip6_hdr *ip6h = (struct ip6_hdr *)pack; - //const struct icmpv6_hdr *ic6h = (struct icmpv6_hdr *) (pack + sizeof(*ip6h)); - - /* Hop limit field must have 255 */ - if (ip6h->ip6_ctlun.ip6_un1.ip6_un1_hlim != 255) - return false; - /* FIXME: ICMP checksum is valid */ - /* ICMP length (derived from IP length) is 8 or more octets */ - if (ip6h->ip6_ctlun.ip6_un1.ip6_un1_plen < 8) - return false; - /* FIXME: All included options have a length > 0 */ - /* FIXME: If IP source is unspecified, no source link-layer addr option */ - return true; -} - /* Validate an ICMPv6 neighbor solicitation according to RFC4861 7.1.1 */ static bool icmpv6_validate_neigh_solicit(const uint8_t *pack, unsigned len) { @@ -207,37 +51,6 @@ return true; } -/* Validate an ICMPv6 router advertisement according to RFC4861 6.1.2. - Returns pointer packet header on success, NULL otherwise. */ -struct icmpv6_radv_hdr *icmpv6_validate_router_adv(const uint8_t *pack, unsigned len) -{ - const struct ip6_hdr *ip6h = (struct ip6_hdr *)pack; - const struct icmpv6_hdr *ic6h = (struct icmpv6_hdr *) (pack + sizeof(*ip6h)); - - /* ICMP length (derived from IP length) is 16 or more octets */ - if (len < sizeof(*ip6h) + 16) - return NULL; - - if (ic6h->type != 134) /* router advertismenet type */ - return NULL; - - /*Routers must use their link-local address */ - if (!IN6_IS_ADDR_LINKLOCAL(&ip6h->ip6_src)) - return NULL; - /* Hop limit field must have 255 */ - if (ip6h->ip6_ctlun.ip6_un1.ip6_un1_hlim != 255) - return NULL; - /* ICMP Code is 0 */ - if (ic6h->code != 0) - return NULL; - /* ICMP length (derived from IP length) is 16 or more octets */ - if (ip6h->ip6_ctlun.ip6_un1.ip6_un1_plen < 16) - return NULL; - /* FIXME: All included options have a length > 0 */ - /* FIXME: If IP source is unspecified, no source link-layer addr option */ - return (struct icmpv6_radv_hdr *)ic6h; -} - /* handle incoming packets to the all-routers multicast address */ int handle_router_mcast(struct gsn_t *gsn, struct pdp_t *pdp, const struct in6_addr *pdp_prefix, @@ -246,7 +59,7 @@ const uint8_t *pack, unsigned len) { const struct ip6_hdr *ip6h = (struct ip6_hdr *)pack; - const struct icmpv6_hdr *ic6h = (struct icmpv6_hdr *) (pack + sizeof(*ip6h)); + const struct osmo_icmpv6_hdr *ic6h = (struct osmo_icmpv6_hdr *) (pack + sizeof(*ip6h)); struct msgb *msg; if (len < sizeof(*ip6h)) { @@ -271,7 +84,7 @@ LOGP(DICMP6, LOGL_NOTICE, "ICMPv6 type 133 but code %d\n", ic6h->code); return -1; } - if (!icmpv6_validate_router_solicit(pack, len)) { + if (!osmo_icmpv6_validate_router_solicit(pack, len)) { LOGP(DICMP6, LOGL_NOTICE, "Invalid Router Solicitation: %s\n", osmo_hexdump(pack, len)); return -1; @@ -279,7 +92,7 @@ /* Send router advertisement from GGSN link-local * address to MS link-local address, including prefix * allocated to this PDP context */ - msg = icmpv6_construct_ra(own_ll_addr, &ip6h->ip6_src, pdp_prefix, mtu); + msg = osmo_icmpv6_construct_ra(own_ll_addr, &ip6h->ip6_src, pdp_prefix, mtu); /* Send the constructed RA to the MS */ gtp_data_req(gsn, pdp, msgb_data(msg), msgb_length(msg)); msgb_free(msg); @@ -295,7 +108,7 @@ int handle_solicited_node_mcast(const uint8_t *pack, unsigned len) { const struct ip6_hdr *ip6h = (struct ip6_hdr *)pack; - const struct icmpv6_hdr *ic6h = (struct icmpv6_hdr *) (pack + sizeof(*ip6h)); + const struct osmo_icmpv6_hdr *ic6h = (struct osmo_icmpv6_hdr *) (pack + sizeof(*ip6h)); if (len < sizeof(*ip6h)) { LOGP(DICMP6, LOGL_NOTICE, "Packet too short: %u bytes\n", len); diff --git a/lib/icmpv6.h b/lib/icmpv6.h index 2469ed0..08bb506 100644 --- a/lib/icmpv6.h +++ b/lib/icmpv6.h @@ -1,109 +1,13 @@ #pragma once -#include <stdbool.h> - -#include <osmocom/core/msgb.h> -#include <osmocom/core/endian.h> +#include <stdint.h> #include <osmocom/gtp/gtp.h> #include <osmocom/gtp/pdp.h> -#define ICMPv6_OPT_TYPE_PREFIX_INFO 0x03 - -#define foreach_icmpv6_opt(icmpv6_pkt, icmpv6_len, opt_hdr) \ - for (opt_hdr = (struct icmpv6_opt_hdr *)(icmpv6_pkt)->options; \ - (uint8_t*)(opt_hdr) + sizeof(struct icmpv6_opt_hdr) <= (((uint8_t*)(icmpv6_pkt)) + (icmpv6_len)); \ - opt_hdr = (struct icmpv6_opt_hdr*)((uint8_t*)(opt_hdr) + (opt_hdr)->len) \ - ) - -struct icmpv6_hdr { - uint8_t type; - uint8_t code; - uint16_t csum; -} __attribute__ ((packed)); - -struct icmpv6_echo_hdr { - struct icmpv6_hdr hdr; - uint16_t ident; /* Identifier */ - uint16_t seq; /* Sequence number */ - uint8_t data[0]; /* Data */ -} __attribute__ ((packed)); - -/* RFC4861 Section 4.1 */ -struct icmpv6_rsol_hdr { - struct icmpv6_hdr hdr; - uint32_t reserved; - uint8_t options[0]; -} __attribute__ ((packed)); - -/* RFC4861 Section 4.2 */ -struct icmpv6_radv_hdr { - struct icmpv6_hdr hdr; - uint8_t cur_ho_limit; -#if OSMO_IS_LITTLE_ENDIAN - uint8_t res:6, - m:1, - o:1; -#elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ - uint8_t o:1, m:1, res:6; -#endif - uint16_t router_lifetime; - uint32_t reachable_time; - uint32_t retrans_timer; - uint8_t options[0]; -} __attribute__ ((packed)); - - -/* RFC4861 Section 4.6 */ -struct icmpv6_opt_hdr { - uint8_t type; - /* length in units of 8 octets, including type+len! */ - uint8_t len; - uint8_t data[0]; -} __attribute__ ((packed)); - -/* RFC4861 Section 4.6.2 */ -struct icmpv6_opt_prefix { - struct icmpv6_opt_hdr hdr; - uint8_t prefix_len; -#if OSMO_IS_LITTLE_ENDIAN - uint8_t res:6, - a:1, - l:1; -#elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ - uint8_t l:1, a:1, res:6; -#endif - uint32_t valid_lifetime; - uint32_t preferred_lifetime; - uint32_t res2; - uint8_t prefix[16]; -} __attribute__ ((packed)); - -/* RFC4861 Section 4.6.4 */ -struct icmpv6_opt_mtu { - struct icmpv6_opt_hdr hdr; - uint16_t reserved; - uint32_t mtu; -} __attribute__ ((packed)); - -uint16_t icmpv6_prepend_ip6hdr(struct msgb *msg, const struct in6_addr *saddr, - const struct in6_addr *daddr); - -struct msgb *icmpv6_construct_rs(const struct in6_addr *saddr); - int handle_router_mcast(struct gsn_t *gsn, struct pdp_t *pdp, const struct in6_addr *pdp_prefix, const struct in6_addr *own_ll_addr, uint32_t mtu, const uint8_t *pack, unsigned len); int handle_solicited_node_mcast(const uint8_t *pack, unsigned len); - -struct icmpv6_radv_hdr *icmpv6_validate_router_adv(const uint8_t *pack, unsigned len); - - -/* RFC3307 link-local scope multicast address */ -extern const struct in6_addr all_router_mcast_addr; - -extern const uint8_t solicited_node_mcast_addr_prefix[13]; diff --git a/sgsnemu/Makefile.am b/sgsnemu/Makefile.am index 5d88c7f..d28673f 100644 --- a/sgsnemu/Makefile.am +++ b/sgsnemu/Makefile.am @@ -9,9 +9,15 @@ -DSBINDIR='"$(sbindir)"' \ -I$(top_srcdir)/include \ $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMONETIF_CFLAGS) \ $(NULL) -sgsnemu_LDADD = @EXEC_LDADD@ -lgtp -L../gtp ../lib/libmisc.a $(LIBOSMOCORE_LIBS) +sgsnemu_LDADD = \ + @EXEC_LDADD@ \ + -lgtp -L../gtp ../lib/libmisc.a \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMONETIF_LIBS) \ + $(NULL) if ENABLE_GTP_KERNEL AM_CFLAGS += \ diff --git a/sgsnemu/sgsnemu.c b/sgsnemu/sgsnemu.c index ee74def..ff2cfc7 100644 --- a/sgsnemu/sgsnemu.c +++ b/sgsnemu/sgsnemu.c @@ -25,6 +25,8 @@ #include <osmocom/core/msgb.h> #include <osmocom/core/select.h> +#include <osmocom/netif/icmpv6.h> + #include <ctype.h> #include <netdb.h> #include <signal.h> @@ -178,7 +180,7 @@ } __attribute__ ((packed)); struct ip6_ping { - struct icmpv6_echo_hdr hdr; + struct osmo_icmpv6_echo_hdr hdr; uint8_t data[CREATEPING_MAX]; /* Data */ } __attribute__ ((packed)); @@ -1265,7 +1267,7 @@ static int cb_gtpu_data_ind_ping6(struct pdp_t *pdp, struct ip6_hdr *ip6h, unsigned len) { - const struct icmpv6_echo_hdr *ic6h = (struct icmpv6_echo_hdr *) ((uint8_t*)ip6h + sizeof(*ip6h)); + const struct osmo_icmpv6_echo_hdr *ic6h = (struct osmo_icmpv6_echo_hdr *) ((uint8_t *)ip6h + sizeof(*ip6h)); struct timeval tv; struct timeval tp; int triptime; @@ -1285,7 +1287,7 @@ return 0; } - if (len < sizeof(struct ip6_hdr) + sizeof(struct icmpv6_echo_hdr)) { + if (len < sizeof(struct ip6_hdr) + sizeof(struct osmo_icmpv6_echo_hdr)) { LOGP(DSGSN, LOGL_ERROR, "Packet len too small to contain ICMPv6 echo header (%d)\n", len); return 0; } @@ -1305,7 +1307,7 @@ inet_ntop(AF_INET6, &ip6h->ip6_src, straddr, sizeof(straddr)), ntohs(ic6h->seq)); - if (len >= sizeof(struct ip6_hdr) + sizeof(struct icmpv6_echo_hdr) + sizeof(struct timeval)) { + if (len >= sizeof(struct ip6_hdr) + sizeof(struct osmo_icmpv6_echo_hdr) + sizeof(struct timeval)) { gettimeofday(&tv, NULL); memcpy(&tp, ic6h->data, sizeof(struct timeval)); if ((tv.tv_usec -= tp.tv_usec) < 0) { @@ -1441,7 +1443,7 @@ struct msgb *msg = msgb_alloc_headroom(sizeof(struct ip6_ping) + 128,128, "ICMPv6 echo"); OSMO_ASSERT(msg); - pack = (struct ip6_ping *) msgb_put(msg, sizeof(struct icmpv6_echo_hdr) + datasize); + pack = (struct ip6_ping *) msgb_put(msg, sizeof(struct osmo_icmpv6_echo_hdr) + datasize); pack->hdr.hdr.type = 128; pack->hdr.hdr.code = 0; pack->hdr.hdr.csum = 0; /* updated below */ @@ -1457,7 +1459,7 @@ gettimeofday(tp, &tz); } - pack->hdr.hdr.csum = icmpv6_prepend_ip6hdr(msg, &src->v6, &dst->v6); + pack->hdr.hdr.csum = osmo_icmpv6_prepend_ip6hdr(msg, &src->v6, &dst->v6); ntransmitted++; return gtp_data_req(gsn, pdp, msgb_data(msg), msgb_length(msg)); @@ -1682,7 +1684,7 @@ return EOF; /* Not a valid IP address */ } SYS_ERR(DSGSN, LOGL_INFO, 0, "Sending ICMPv6 Router Soliciation to GGSN..."); - msg = icmpv6_construct_rs(saddr6); + msg = osmo_icmpv6_construct_rs(saddr6); gtp_data_req(gsn, ctx->pdp, msgb_data(msg), msgb_length(msg)); msgb_free(msg); } @@ -1748,11 +1750,12 @@ } } -static void handle_router_adv(struct pdp_t *pdp, struct ip6_hdr *ip6h, struct icmpv6_radv_hdr *ra, size_t ra_len) +static void handle_router_adv(struct pdp_t *pdp, struct ip6_hdr *ip6h, + struct osmo_icmpv6_radv_hdr *ra, size_t ra_len) { struct pdp_peer_sgsnemu_ctx* ctx = (struct pdp_peer_sgsnemu_ctx*)pdp->peer[0]; - struct icmpv6_opt_hdr *opt_hdr; - struct icmpv6_opt_prefix *opt_prefix; + struct osmo_icmpv6_opt_hdr *opt_hdr; + struct osmo_icmpv6_opt_prefix *opt_prefix; int rc; sigset_t oldmask; struct in6_addr rm; @@ -1763,7 +1766,7 @@ foreach_icmpv6_opt(ra, ra_len, opt_hdr) { if (opt_hdr->type == ICMPv6_OPT_TYPE_PREFIX_INFO) { - opt_prefix = (struct icmpv6_opt_prefix *)opt_hdr; + opt_prefix = (struct osmo_icmpv6_opt_prefix *)opt_hdr; size_t prefix_len_bytes = (opt_prefix->prefix_len + 7)/8; SYS_ERR(DSGSN, LOGL_INFO, 0, "Parsing OPT Prefix info (prefix_len=%u): %s", opt_prefix->prefix_len, @@ -1821,10 +1824,10 @@ static int cb_gtpu_data_ind(struct pdp_t *pdp, void *pack, unsigned len) { struct iphdr *iph = (struct iphdr *)pack; - struct icmpv6_radv_hdr *ra; + struct osmo_icmpv6_radv_hdr *ra; switch (iph->version) { case 6: - if ((ra = icmpv6_validate_router_adv(pack, len))) { + if ((ra = osmo_icmpv6_validate_router_adv(pack, len))) { size_t ra_len = (uint8_t*)ra - (uint8_t*)pack; handle_router_adv(pdp, (struct ip6_hdr *)pack, ra, ra_len); return 0; -- To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/42465?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-ggsn Gerrit-Branch: master Gerrit-Change-Id: I8d8fae362f302d48afaed28a9c664f76ca4a2739 Gerrit-Change-Number: 42465 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[L] Change in osmo-ggsn[master]: Depend on libosmo-netif for icmpv6 APIs
by pespin 24 Mar '26

24 Mar '26
Attention is currently required from: laforge. pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/42465?usp=email ) Change subject: Depend on libosmo-netif for icmpv6 APIs ...................................................................... Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/42465?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-ggsn Gerrit-Branch: master Gerrit-Change-Id: I8d8fae362f302d48afaed28a9c664f76ca4a2739 Gerrit-Change-Number: 42465 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Tue, 24 Mar 2026 11:32:09 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[M] Change in osmo-uecups[master]: Support configuring IPv4v6 tunnels
by pespin 24 Mar '26

24 Mar '26
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-uecups/+/42470?usp=email ) Change subject: Support configuring IPv4v6 tunnels ...................................................................... Support configuring IPv4v6 tunnels Change-Id: Ic2da7a761a8df7e006fc02ca6557a48f371e4151 --- M daemon/cups_client.c M daemon/daemon_vty.c M daemon/gtp_endpoint.c M daemon/gtp_tunnel.c M daemon/internal.h M ttcn3/UECUPS_Types.ttcn 6 files changed, 138 insertions(+), 51 deletions(-) Approvals: fixeria: Looks good to me, but someone else must approve Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/daemon/cups_client.c b/daemon/cups_client.c index f7c6f1a..a96861f 100644 --- a/daemon/cups_client.c +++ b/daemon/cups_client.c @@ -198,9 +198,9 @@ json_object_set_new(jslaac_ind, "ipv6_prefix", json_string(ipv6_str)); osmo_hexdump_buf(ipv6_str, sizeof(ipv6_str), - (const unsigned char *)&t->user_addr.u.sin6.sin6_addr, - sizeof(t->user_addr.u.sin6.sin6_addr), - "", true); + (const unsigned char *)&t->user_addr_ipv6_global.u.sin6.sin6_addr, + sizeof(t->user_addr_ipv6_global.u.sin6.sin6_addr), + "", true); json_object_set_new(jslaac_ind, "ipv6_user_addr", json_string(ipv6_str)); json_str = json_dumps(jtx, JSON_SORT_KEYS); @@ -265,21 +265,26 @@ return 0; } -static int parse_eua(struct osmo_sockaddr *out, json_t *jip, json_t *jaddr_type) +static int parse_eua(enum gtp1u_eua_type *user_addr_type, struct osmo_sockaddr *out4, + struct osmo_sockaddr *out6, json_t *jip, json_t *jaddr_type) { const char *addr_type, *ip; - uint8_t buf[16]; - + uint8_t buf[20]; + struct sockaddr_in *sin = &out4->u.sin; + struct sockaddr_in6 *sin6 = &out6->u.sin6; if (!json_is_string(jip) || !json_is_string(jaddr_type)) return -EINVAL; addr_type = json_string_value(jaddr_type); ip = json_string_value(jip); - memset(out, 0, sizeof(*out)); + memset(out4, 0, sizeof(*out4)); + out4->u.sa.sa_family = AF_UNSPEC; + memset(out6, 0, sizeof(*out6)); + out6->u.sa.sa_family = AF_UNSPEC; if (!strcmp(addr_type, "IPV4")) { - struct sockaddr_in *sin = &out->u.sin; + *user_addr_type = GTP1U_EUA_TYPE_IPv4; if (osmo_hexparse(ip, buf, sizeof(buf)) != 4) { LOGP(DUECUPS, LOGL_NOTICE, "Failed parsing EUA %s type %s\n", ip, addr_type); return -EINVAL; @@ -287,13 +292,23 @@ memcpy(&sin->sin_addr, buf, 4); sin->sin_family = AF_INET; } else if (!strcmp(addr_type, "IPV6")) { - struct sockaddr_in6 *sin6 = &out->u.sin6; + *user_addr_type = GTP1U_EUA_TYPE_IPv6; if (osmo_hexparse(ip, buf, sizeof(buf)) != 16) { LOGP(DUECUPS, LOGL_NOTICE, "Failed parsing EUA %s type %s\n", ip, addr_type); return -EINVAL; } memcpy(&sin6->sin6_addr, buf, 16); sin6->sin6_family = AF_INET6; + } else if (!strcmp(addr_type, "IPV4V6")) { + *user_addr_type = GTP1U_EUA_TYPE_IPv4v6; + if (osmo_hexparse(ip, buf, sizeof(buf)) != 20) { + LOGP(DUECUPS, LOGL_NOTICE, "Failed parsing EUA %s type %s\n", ip, addr_type); + return -EINVAL; + } + memcpy(&sin->sin_addr, buf, 4); + sin->sin_family = AF_INET; + memcpy(&sin6->sin6_addr, buf + 4, 16); + sin6->sin6_family = AF_INET6; } else { LOGP(DUECUPS, LOGL_NOTICE, "Unknown EUA type %s\n", addr_type); return -EINVAL; @@ -395,7 +410,8 @@ rc = parse_ep(&out->remote_udp, jremote_gtp_ep); if (rc < 0) return rc; - rc = parse_eua(&out->user_addr, juser_addr, juser_addr_type); + rc = parse_eua(&out->user_addr_type, &out->user_addr_ipv4, + &out->user_addr_ipv6, juser_addr, juser_addr_type); if (rc < 0) return rc; out->rx_teid = json_integer_value(jrx_teid); diff --git a/daemon/daemon_vty.c b/daemon/daemon_vty.c index 16f23b8..e2562c9 100644 --- a/daemon/daemon_vty.c +++ b/daemon/daemon_vty.c @@ -230,20 +230,34 @@ static void show_one_tunnel(struct vty *vty, const struct gtp_tunnel *t) { - char remote_ip[64], remote_port[16], user_addr[64]; + char remote_ip[64], remote_port[16], user_addr_v4[64], user_addr_v6[64]; getnameinfo(&t->remote_udp.u.sa, sizeof(t->remote_udp.u.sas), remote_ip, sizeof(remote_ip), remote_port, sizeof(remote_port), NI_NUMERICHOST|NI_NUMERICSERV); - getnameinfo(&t->user_addr.u.sa, sizeof(t->user_addr.u.sas), - user_addr, sizeof(user_addr), NULL, 0, - NI_NUMERICHOST|NI_NUMERICSERV); + if (t->user_addr_type == GTP1U_EUA_TYPE_IPv4 || t->user_addr_type == GTP1U_EUA_TYPE_IPv4v6) { + getnameinfo(&t->user_addr_ipv4.u.sa, sizeof(t->user_addr_ipv4.u.sas), + user_addr_v4, sizeof(user_addr_v4), NULL, 0, + NI_NUMERICHOST|NI_NUMERICSERV); + } else { + user_addr_v4[0] = '\0'; + } + if ((t->user_addr_type == GTP1U_EUA_TYPE_IPv6 || t->user_addr_type == GTP1U_EUA_TYPE_IPv4v6) && + t->user_addr_ipv6_global.u.sa.sa_family == AF_INET6) { + getnameinfo(&t->user_addr_ipv6_global.u.sa, sizeof(t->user_addr_ipv6_global.u.sas), + user_addr_v6, sizeof(user_addr_v6), NULL, 0, + NI_NUMERICHOST|NI_NUMERICSERV); + } else { + user_addr_v6[0] = '\0'; + } - - vty_out(vty, "%s/%08X - %s:%s/%08X %s(%s) %s%s", - t->gtp_ep->name, t->rx_teid, remote_ip, remote_port, t->tx_teid, - t->tun_dev->devname, t->tun_dev->netns_name, user_addr, VTY_NEWLINE); + vty_out(vty, "%s/%08X - %s:%s/%08X %s(%s) %s%s%s%s", + t->gtp_ep->name, t->rx_teid, + remote_ip, remote_port, t->tx_teid, + t->tun_dev->devname, t->tun_dev->netns_name, user_addr_v4, + (user_addr_v4[0] != '\0' && user_addr_v6[0] != '\0') ? " " : "", + user_addr_v6, VTY_NEWLINE); } DEFUN(show_tunnel, show_tunnel_cmd, diff --git a/daemon/gtp_endpoint.c b/daemon/gtp_endpoint.c index 0332f91..524226c 100644 --- a/daemon/gtp_endpoint.c +++ b/daemon/gtp_endpoint.c @@ -72,19 +72,20 @@ 0, 16 - prefix_len_bytes); /* Pick second address in the prefix: */ - memcpy(&t->user_addr.u.sin6.sin6_addr, + t->user_addr_ipv6_global.u.sa.sa_family = AF_INET6; + memcpy(&t->user_addr_ipv6_global.u.sin6.sin6_addr, &t->user_addr_ipv6_prefix.u.sin6.sin6_addr, sizeof(t->user_addr_ipv6_prefix.u.sin6.sin6_addr)); - ((uint8_t *)&t->user_addr.u.sin6.sin6_addr)[15] = 2; + ((uint8_t *)&t->user_addr_ipv6_global.u.sin6.sin6_addr)[15] = 2; LOGT(t, LOGL_INFO, "Adding global IPv6 prefix %s/%u address %s\n", inet_ntop(AF_INET6, &t->user_addr_ipv6_prefix.u.sin6.sin6_addr, &ip6strbuf[0][0], sizeof(ip6strbuf[0])), opt_prefix->prefix_len, - inet_ntop(AF_INET6, &t->user_addr.u.sin6.sin6_addr, &ip6strbuf[1][0], sizeof(ip6strbuf[1]))); + inet_ntop(AF_INET6, &t->user_addr_ipv6_global.u.sin6.sin6_addr, &ip6strbuf[1][0], sizeof(ip6strbuf[1]))); - if ((rc = osmo_netdev_add_addr(t->tun_dev->netdev, &t->user_addr, 64)) < 0) { + if ((rc = osmo_netdev_add_addr(t->tun_dev->netdev, &t->user_addr_ipv6_global, 64)) < 0) { LOGT(t, LOGL_ERROR, "Cannot add global IPv6 user addr %s to tun device: %s\n", - inet_ntop(AF_INET6, &t->user_addr.u.sin6.sin6_addr, &ip6strbuf[1][0], sizeof(ip6strbuf[1])), + inet_ntop(AF_INET6, &t->user_addr_ipv6_global.u.sin6.sin6_addr, &ip6strbuf[1][0], sizeof(ip6strbuf[1])), strerror(-rc)); } @@ -174,12 +175,12 @@ struct osmo_icmpv6_radv_hdr *ra; switch (iph->version) { case 4: - if (t->user_addr.u.sa.sa_family != AF_INET) { + if (t->user_addr_ipv4.u.sa.sa_family != AF_INET) { LOGT(t, LOGL_NOTICE, "Rx GTPU payload for unexpected IPv4 %s in non-IPv4 PDP Context\n", inet_ntop(AF_INET, &iph->daddr, ip6strbuf, sizeof(ip6strbuf))); goto unlock_ret; } - if (memcmp(&iph->daddr, &t->user_addr.u.sin.sin_addr, 4) != 0) { + if (memcmp(&iph->daddr, &t->user_addr_ipv4.u.sin.sin_addr, 4) != 0) { LOGT(t, LOGL_NOTICE, "Rx GTPU payload for unknown dst IP addr %s\n", inet_ntop(AF_INET, &iph->daddr, ip6strbuf, sizeof(ip6strbuf))); goto unlock_ret; @@ -187,12 +188,12 @@ break; case 6: ip6h = (struct ip6_hdr *)payload; - if (t->user_addr.u.sa.sa_family != AF_INET6) { - LOGT(t, LOGL_NOTICE, "Rx GTPU payload for unexpected IPv6 %s in non-IPv6 PDP Context\n", - inet_ntop(AF_INET6, &ip6h->ip6_dst, ip6strbuf, sizeof(ip6strbuf))); - goto unlock_ret; - } if (IN6_IS_ADDR_LINKLOCAL(&ip6h->ip6_dst)) { + if (t->user_addr_ipv6_ll.u.sa.sa_family != AF_INET6) { + LOGT(t, LOGL_NOTICE, "Rx GTPU payload for unexpected IPv6 %s in non-IPv6 PDP Context\n", + inet_ntop(AF_INET6, &ip6h->ip6_dst, ip6strbuf, sizeof(ip6strbuf))); + goto unlock_ret; + } if (memcmp(&ip6h->ip6_dst, &t->user_addr_ipv6_ll.u.sin6.sin6_addr, 16) != 0) { LOGT(t, LOGL_NOTICE, "Rx GTPU payload for unknown link-local dst IP addr %s\n", inet_ntop(AF_INET6, &ip6h->ip6_dst, ip6strbuf, sizeof(ip6strbuf))); @@ -203,11 +204,18 @@ handle_router_adv(t, (struct ip6_hdr *)payload, ra, ra_len); goto unlock_ret; } - /* Match by global IPv6 /64 prefix allocated through SLAAC: */ - } else if (memcmp(&ip6h->ip6_dst, &t->user_addr.u.sin6.sin6_addr, 8) != 0) { - LOGT(t, LOGL_NOTICE, "Rx GTPU payload for unknown global dst IP addr %s\n", - inet_ntop(AF_INET6, &ip6h->ip6_dst, ip6strbuf, sizeof(ip6strbuf))); - goto unlock_ret; + } else { + /* Match by global IPv6 /64 prefix allocated through SLAAC: */ + if (t->user_addr_ipv6_global.u.sa.sa_family != AF_INET6) { + LOGT(t, LOGL_NOTICE, "Rx GTPU payload for unexpected IPv6 %s in non-IPv6 PDP Context\n", + inet_ntop(AF_INET6, &ip6h->ip6_dst, ip6strbuf, sizeof(ip6strbuf))); + goto unlock_ret; + } + if (memcmp(&ip6h->ip6_dst, &t->user_addr_ipv6_prefix.u.sin6.sin6_addr, 8) != 0) { + LOGT(t, LOGL_NOTICE, "Rx GTPU payload for unknown global dst IP addr %s\n", + inet_ntop(AF_INET6, &ip6h->ip6_dst, ip6strbuf, sizeof(ip6strbuf))); + goto unlock_ret; + } } break; default: diff --git a/daemon/gtp_tunnel.c b/daemon/gtp_tunnel.c index 2765488..fc99e4f 100644 --- a/daemon/gtp_tunnel.c +++ b/daemon/gtp_tunnel.c @@ -57,15 +57,28 @@ t->rx_teid = cpars->rx_teid; t->tx_teid = cpars->tx_teid; memcpy(&t->exthdr, &cpars->exthdr, sizeof(t->exthdr)); - memcpy(&t->user_addr_ipv6_ll, &cpars->user_addr, sizeof(t->user_addr)); - memcpy(&t->user_addr, &t->user_addr_ipv6_ll, sizeof(t->user_addr_ipv6_ll)); - memcpy(&t->remote_udp, &cpars->remote_udp, sizeof(t->remote_udp)); - if ((rc = osmo_netdev_add_addr(t->tun_dev->netdev, &t->user_addr, 32)) < 0) { - LOGT(t, LOGL_ERROR, "Cannot add user addr to tun device: %s\n", - strerror(-rc)); + if (cpars->user_addr_type == GTP1U_EUA_TYPE_IPv4 || cpars->user_addr_type == GTP1U_EUA_TYPE_IPv4v6) { + memcpy(&t->user_addr_ipv4, &cpars->user_addr_ipv4, sizeof(t->user_addr_ipv4)); + if ((rc = osmo_netdev_add_addr(t->tun_dev->netdev, &t->user_addr_ipv4, 32)) < 0) { + LOGT(t, LOGL_ERROR, "Cannot add user addr to tun device: %s\n", + strerror(-rc)); + } + } else { + t->user_addr_ipv4.u.sa.sa_family = AF_UNSPEC; } + t->user_addr_type = cpars->user_addr_type; + if (cpars->user_addr_type == GTP1U_EUA_TYPE_IPv6 || cpars->user_addr_type == GTP1U_EUA_TYPE_IPv4v6) + memcpy(&t->user_addr_ipv6_ll, &cpars->user_addr_ipv6, sizeof(t->user_addr_ipv6_ll)); + else + t->user_addr_ipv6_ll.u.sa.sa_family = AF_UNSPEC; + + /* user_addr_ipv6_global will be set later on during IPv6 SLAAC procedure: */ + t->user_addr_ipv6_global.u.sa.sa_family = AF_UNSPEC; + + memcpy(&t->remote_udp, &cpars->remote_udp, sizeof(t->remote_udp)); + /* TODO: hash table? */ llist_add_tail(&t->list, &d->gtp_tunnels); pthread_rwlock_unlock(&d->rwlock); @@ -125,9 +138,23 @@ llist_for_each_entry(t, &d->gtp_tunnels, list) { /* TODO: Find best matching filter */ - if (t->tun_dev == tun && - osmo_sockaddr_cmp(osa, &t->user_addr) == 0) + if (t->tun_dev != tun) + continue; + switch (osa->u.sa.sa_family) { + case AF_INET: + if (t->user_addr_type == GTP1U_EUA_TYPE_IPv6) + continue; + if (osmo_sockaddr_cmp(osa, &t->user_addr_ipv4) != 0) + continue; return t; + case AF_INET6: + if (t->user_addr_type == GTP1U_EUA_TYPE_IPv4) + continue; + if (osmo_sockaddr_cmp(osa, &t->user_addr_ipv6_ll) != 0 && + osmo_sockaddr_cmp(osa, &t->user_addr_ipv6_global) != 0) + continue; + return t; + } } return NULL; } @@ -141,8 +168,18 @@ /* talloc is not thread safe, all alloc/free must come from main thread */ ASSERT_MAIN_THREAD(t->d); - if ((rc = osmo_netdev_del_addr(t->tun_dev->netdev, &t->user_addr, 32)) < 0) - LOGT(t, LOGL_ERROR, "Cannot remove user address: %s\n", strerror(-rc)); + if (t->user_addr_type == GTP1U_EUA_TYPE_IPv4 || t->user_addr_type == GTP1U_EUA_TYPE_IPv4v6) { + if ((rc = osmo_netdev_del_addr(t->tun_dev->netdev, &t->user_addr_ipv4, 32)) < 0) + LOGT(t, LOGL_ERROR, "Cannot remove IPv4 user address: %s\n", strerror(-rc)); + } + if (t->user_addr_type == GTP1U_EUA_TYPE_IPv6 || t->user_addr_type == GTP1U_EUA_TYPE_IPv4v6) { + if ((rc = osmo_netdev_del_addr(t->tun_dev->netdev, &t->user_addr_ipv6_ll, 32)) < 0) + LOGT(t, LOGL_ERROR, "Cannot remove IPv6 link-local user address: %s\n", strerror(-rc)); + if (t->user_addr_ipv6_global.u.sa.sa_family != AF_UNSPEC) { + if ((rc = osmo_netdev_del_addr(t->tun_dev->netdev, &t->user_addr_ipv6_global, 32)) < 0) + LOGT(t, LOGL_ERROR, "Cannot remove IPv6 global user address: %s\n", strerror(-rc)); + } + } llist_del(&t->list); @@ -180,9 +217,10 @@ struct msgb *msg; int rc; - OSMO_ASSERT(t->user_addr.u.sa.sa_family == AF_INET6); + OSMO_ASSERT(t->user_addr_type == GTP1U_EUA_TYPE_IPv6 || + t->user_addr_type == GTP1U_EUA_TYPE_IPv4v6); - msg = osmo_icmpv6_construct_rs(&t->user_addr.u.sin6.sin6_addr); + msg = osmo_icmpv6_construct_rs(&t->user_addr_ipv6_ll.u.sin6.sin6_addr); pthread_rwlock_rdlock(&t->d->rwlock); rc = tx_gtp1u_pkt(t, msg->head, msgb_data(msg), msgb_length(msg)); diff --git a/daemon/internal.h b/daemon/internal.h index 5d4b832..d9e040c 100644 --- a/daemon/internal.h +++ b/daemon/internal.h @@ -172,6 +172,12 @@ * this is what happens when IP arrives on the tun device */ +enum gtp1u_eua_type { + GTP1U_EUA_TYPE_IPv4, + GTP1U_EUA_TYPE_IPv6, + GTP1U_EUA_TYPE_IPv4v6, +}; + struct gtp1u_exthdr_pdu_sess_container { bool enabled; uint8_t pdu_type; /* GTP1_EXTHDR_PDU_TYPE_* */ @@ -203,9 +209,11 @@ uint32_t rx_teid; /* End user Address (inner IP) */ + enum gtp1u_eua_type user_addr_type; + struct osmo_sockaddr user_addr_ipv4; struct osmo_sockaddr user_addr_ipv6_ll; struct osmo_sockaddr user_addr_ipv6_prefix; - struct osmo_sockaddr user_addr; + struct osmo_sockaddr user_addr_ipv6_global; /* Remote UDP IP/Port*/ struct osmo_sockaddr remote_udp; @@ -231,7 +239,9 @@ struct gtp1u_exthdrs exthdr; /* end user address */ - struct osmo_sockaddr user_addr; + enum gtp1u_eua_type user_addr_type; + struct osmo_sockaddr user_addr_ipv4; + struct osmo_sockaddr user_addr_ipv6; /* remote GTP/UDP IP+Port */ struct osmo_sockaddr remote_udp; diff --git a/ttcn3/UECUPS_Types.ttcn b/ttcn3/UECUPS_Types.ttcn index 45466c8..ba4e7d4 100644 --- a/ttcn3/UECUPS_Types.ttcn +++ b/ttcn3/UECUPS_Types.ttcn @@ -7,7 +7,8 @@ type enumerated UECUPS_AddrType { IPV4 (1), - IPV6 (2) + IPV6 (2), + IPV4V6 (3) }; type enumerated UECUPS_Result { @@ -43,7 +44,7 @@ /* user address (allocated inside the tunnel) */ UECUPS_AddrType user_addr_type, - OCT4_16n user_addr, + OCT4_20n user_addr, /* GTP endpoint (UDP IP/Port tuples) */ UECUPS_SockAddr local_gtp_ep, -- To view, visit https://gerrit.osmocom.org/c/osmo-uecups/+/42470?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-uecups Gerrit-Branch: master Gerrit-Change-Id: Ic2da7a761a8df7e006fc02ca6557a48f371e4151 Gerrit-Change-Number: 42470 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[M] Change in osmo-uecups[master]: Support configuring IPv4v6 tunnels
by pespin 24 Mar '26

24 Mar '26
pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-uecups/+/42470?usp=email ) Change subject: Support configuring IPv4v6 tunnels ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-uecups/+/42470?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-uecups Gerrit-Branch: master Gerrit-Change-Id: Ic2da7a761a8df7e006fc02ca6557a48f371e4151 Gerrit-Change-Number: 42470 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Tue, 24 Mar 2026 11:31:39 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: 5gc: Introduce test TC_pdu_sess_est_always_on
by pespin 24 Mar '26

24 Mar '26
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42478?usp=email ) Change subject: 5gc: Introduce test TC_pdu_sess_est_always_on ...................................................................... 5gc: Introduce test TC_pdu_sess_est_always_on Change-Id: I282e0c8072172fa633bf82ed6b9492b0bb4362cc --- M 5gc/C5G_Tests.ttcn M 5gc/ConnHdlr.ttcn M 5gc/expected-results.xml 3 files changed, 49 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/78/42478/1 diff --git a/5gc/C5G_Tests.ttcn b/5gc/C5G_Tests.ttcn index 0aa24a5..4ef546d 100644 --- a/5gc/C5G_Tests.ttcn +++ b/5gc/C5G_Tests.ttcn @@ -396,6 +396,27 @@ vc_conn.done; } +/* 3GPP TS 24.501 8.3.1.7 Always-on PDU session requested (see also 9.11.4.4) + * 3GPP TS 24.501 8.3.2.6 Always-on PDU session indication (see also 9.11.4.3) */ +private function f_TC_pdu_sess_est_always_on() runs on ConnHdlr { + f_register(); + f_pdu_sess_establish(p_AlwaysOnPDUSessionReq := crs_AlwaysOn('1'B), + configure_userplane := false); + f_sleep(1.0); + f_pdu_sess_modify(); + f_pdu_sess_release(); + f_deregister(); +} +testcase TC_pdu_sess_est_always_on() runs on MTC_CT { + f_init(); + f_ngap_setup(0); + + var ConnHdlrPars pars := f_init_pars(ue_idx := 0); + var ConnHdlr vc_conn; + vc_conn := f_start_handler_with_pars(refers(f_TC_pdu_sess_est_always_on), pars); + vc_conn.done; +} + private function f_TC_register_ping4() runs on ConnHdlr { f_register(); f_pdu_sess_establish(pdu_sess_type := c_PDU_SessionType_IPv4); @@ -1046,6 +1067,7 @@ execute( TC_ue_context_release_no_pdu_session() ); execute( TC_ue_context_release_with_pdu_session() ); execute( TC_pdu_sess_modification() ); + execute( TC_pdu_sess_est_always_on() ); execute( TC_ng_register_ping4() ); execute( TC_ng_register_ping4_256() ); diff --git a/5gc/ConnHdlr.ttcn b/5gc/ConnHdlr.ttcn index a90bc64..2b4209f 100644 --- a/5gc/ConnHdlr.ttcn +++ b/5gc/ConnHdlr.ttcn @@ -544,20 +544,24 @@ log("Using IPv6 global address: ", g_pars.ue_pars.sess_pars.ue_ip6); } -/* 3GPP TS 23.502 4.3.2.2 UE Requested PDU Session Establishment */ +/* 3GPP TS 23.502 4.3.2.2 UE Requested PDU Session Establishment + * 3GPP TS 24.501 8.3.1 PDU session establishment request */ function f_pdu_sess_establish(BIT3 request_type := c_RequestType_initial_request, BIT3 pdu_sess_type := c_PDU_SessionType_IPv4, + template (omit) AlwaysOnPDUSessionReq p_AlwaysOnPDUSessionReq := omit, boolean configure_userplane := true) runs on ConnHdlr { var template (value) NG_NAS_UL_Message_Type nas_ul_msg; var NAS_PDU nas_pdu; var NG_NAS_DL_Message_Type rx_nas, inner_nas; var ProcedureTransactionIdentifier pti := f_next_pti(); var OCT1 pdu_sess_id := int2oct(g_pars.ue_pars.sess_pars.id, 1); + var NG_PDU_SESSION_ESTABLISHMENT_ACCEPT sess_acc; nas_ul_msg := cs_NG_PDU_SESSION_ESTABLISHMENT_REQUEST(cs_NG_PDU_SessionIdV(pdu_sess_id), pti, p_IntegrityProtMaxDataRate := cs_IntegrityProtMaxDataRateV('FF'O, 'FF'O), p_PDU_SessionType := cs_PDU_SessionTypeTV(pdu_sess_type), - p_SSC_Mode := cs_SSC_ModeTV('001'B)); + p_SSC_Mode := cs_SSC_ModeTV('001'B), + p_AlwaysOnPDUSessionReq := p_AlwaysOnPDUSessionReq); nas_pdu := enc_NG_NAS_UL_Message_Type(valueof(nas_ul_msg)); nas_ul_msg := cs_NG_UL_NAS_TRANSPORT(cs_PayloadContainerType(tsc_PayloadContainerESMMsg), cs_PayloadContainerLV(nas_pdu), @@ -571,18 +575,29 @@ NGAP.receive(cr_NG_DL_NAS_TRANSPORT) -> value rx_nas; inner_nas := f_dec_NG_NAS_DL_Message_Payload_Container(rx_nas.dl_Nas_Transport.payloadContainerType.container, rx_nas.dl_Nas_Transport.payload.payload); - g_pars.ue_pars.sess_pars.qos_rules := inner_nas.pdu_Session_Establishment_Accept.authorizedQoSRules.listofQoSRules; + sess_acc := inner_nas.pdu_Session_Establishment_Accept; + + /* PDU Session Establisment Accept Checks: */ + if (isvalue(p_AlwaysOnPDUSessionReq)) { + if (not ispresent(sess_acc.alwaysOnPDUSessionInd)) { + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Requested Always-on PDU but got no Always-on Indication")); + } else if(match(sess_acc.alwaysOnPDUSessionInd, cs_AlwaysOnNotAllowed)) { + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Requested Always-on PDU but got Always-on Not Allowed")); + } + } + + g_pars.ue_pars.sess_pars.qos_rules := sess_acc.authorizedQoSRules.listofQoSRules; log("5GC assigned CN GTPU Address: ", g_pars.ue_pars.sess_pars.cn_gtpu_ip, " TEID: ", g_pars.ue_pars.sess_pars.cn_gtpu_teid); select (pdu_sess_type) { case (c_PDU_SessionType_IPv4) { - g_pars.ue_pars.sess_pars.ue_ip4 := f_inet_ntoa(inner_nas.pdu_Session_Establishment_Accept.pduAddress.adressInfo); + g_pars.ue_pars.sess_pars.ue_ip4 := f_inet_ntoa(sess_acc.pduAddress.adressInfo); log("5GC assigned UE IPv4 address: ", g_pars.ue_pars.sess_pars.ue_ip4); if (configure_userplane) { f_pdu_sess_create_tun(IPV4); } } case (c_PDU_SessionType_IPv6) { - g_pars.ue_pars.sess_pars.ipv6_interface_id := inner_nas.pdu_Session_Establishment_Accept.pduAddress.adressInfo + g_pars.ue_pars.sess_pars.ipv6_interface_id := sess_acc.pduAddress.adressInfo log("5GC assigned IPv6 Interface Id: ", g_pars.ue_pars.sess_pars.ipv6_interface_id); /* Use the link-local address for now: */ var octetstring ll_addr := 'FE80000000000000'O & g_pars.ue_pars.sess_pars.ipv6_interface_id; @@ -594,8 +609,8 @@ } } case (c_PDU_SessionType_IPv4v6) { - var octetstring eua_v6 := substr(inner_nas.pdu_Session_Establishment_Accept.pduAddress.adressInfo, 0, 8); - var octetstring eua_v4 := substr(inner_nas.pdu_Session_Establishment_Accept.pduAddress.adressInfo, 8, 4); + var octetstring eua_v6 := substr(sess_acc.pduAddress.adressInfo, 0, 8); + var octetstring eua_v4 := substr(sess_acc.pduAddress.adressInfo, 8, 4); g_pars.ue_pars.sess_pars.ue_ip4 := f_inet_ntoa(eua_v4); log("5GC assigned UE IPv4 address: ", g_pars.ue_pars.sess_pars.ue_ip4); g_pars.ue_pars.sess_pars.ipv6_interface_id := eua_v6; diff --git a/5gc/expected-results.xml b/5gc/expected-results.xml index 8581cf0..f7850a8 100644 --- a/5gc/expected-results.xml +++ b/5gc/expected-results.xml @@ -8,6 +8,11 @@ <testcase classname='C5G_Tests' name='TC_ue_context_release_no_pdu_session' time='MASKED'/> <testcase classname='C5G_Tests' name='TC_ue_context_release_with_pdu_session' time='MASKED'/> <testcase classname='C5G_Tests' name='TC_pdu_sess_modification' time='MASKED'/> + <testcase classname='C5G_Tests' name='TC_pdu_sess_est_always_on' time='MASKED'> + <failure type='fail-verdict'>"ConnHdlr.ttcn:MASKED : Requested Always-on PDU and got no Always-on Indication" + C5G_Tests.ttcn:MASKED TC_pdu_sess_est_always_on testcase + </failure> + </testcase> <testcase classname='C5G_Tests' name='TC_ng_register_ping4' time='MASKED'/> <testcase classname='C5G_Tests' name='TC_ng_register_ping4_256' time='MASKED'/> <testcase classname='C5G_Tests' name='TC_ng_register_ping6' time='MASKED'/> -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42478?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I282e0c8072172fa633bf82ed6b9492b0bb4362cc Gerrit-Change-Number: 42478 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: GTPv1U_Emulation: Clear entries from PidTable upon rx CUPS program_te...
by pespin 24 Mar '26

24 Mar '26
Attention is currently required from: fixeria, laforge, osmith. Hello Jenkins Builder, fixeria, laforge, osmith, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42472?usp=email to look at the new patch set (#3). The following approvals got outdated and were removed: Code-Review+1 by fixeria, Verified+1 by Jenkins Builder Change subject: GTPv1U_Emulation: Clear entries from PidTable upon rx CUPS program_term_ind ...................................................................... GTPv1U_Emulation: Clear entries from PidTable upon rx CUPS program_term_ind Otherwise it will evnetually run out of entries if enough commands are called sequentially. Change-Id: I7be2639761726c09e4ea6f75c57d8414c5dbf128 --- M library/GTPv1U_Emulation.ttcnpp 1 file changed, 31 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/72/42472/3 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42472?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I7be2639761726c09e4ea6f75c57d8414c5dbf128 Gerrit-Change-Number: 42472 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • ...
  • 194
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.