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 2024

  • 1 participants
  • 1631 discussions
[L] Change in osmo-msc[master]: vlr: add a logging layer
by lynxis lazus 21 Oct '24

21 Oct '24
Attention is currently required from: lynxis lazus, pespin. Hello Jenkins Builder, pespin, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-msc/+/38410?usp=email to look at the new patch set (#6). The following approvals got outdated and were removed: Code-Review+1 by pespin, Verified+1 by Jenkins Builder Change subject: vlr: add a logging layer ...................................................................... vlr: add a logging layer To prepare the split off into a separate library, the logging can't use log category from a define. Use the same strategy as all the other osmo libraries and use a global array which is set on initialisation to define the logging categories. Change-Id: I6d87b38d6d7d704c7c7b2c90ad12187e4b953b8b --- M include/osmocom/vlr/vlr.h M src/libmsc/gsm_04_08.c M src/libmsc/msc_net_init.c M src/libvlr/vlr.c M src/libvlr/vlr_access_req_fsm.c M src/libvlr/vlr_access_req_fsm.h M src/libvlr/vlr_auth_fsm.c M src/libvlr/vlr_core.h M src/libvlr/vlr_lu_fsm.c M src/libvlr/vlr_lu_fsm.h M src/libvlr/vlr_sgs.c M src/libvlr/vlr_sgs_fsm.c M src/libvlr/vlr_sgs_fsm.h M tests/msc_vlr/msc_vlr_test_authen_reuse.err M tests/msc_vlr/msc_vlr_test_call.err M tests/msc_vlr/msc_vlr_test_gsm_authen.err M tests/msc_vlr/msc_vlr_test_gsm_ciph.err M tests/msc_vlr/msc_vlr_test_hlr_reject.err M tests/msc_vlr/msc_vlr_test_hlr_timeout.err M tests/msc_vlr/msc_vlr_test_ms_timeout.err M tests/msc_vlr/msc_vlr_test_no_authen.err M tests/msc_vlr/msc_vlr_test_reject_concurrency.err M tests/msc_vlr/msc_vlr_test_rest.err M tests/msc_vlr/msc_vlr_test_ss.err M tests/msc_vlr/msc_vlr_test_umts_authen.err M tests/msc_vlr/msc_vlr_tests.c 26 files changed, 314 insertions(+), 244 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/10/38410/6 -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/38410?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: I6d87b38d6d7d704c7c7b2c90ad12187e4b953b8b Gerrit-Change-Number: 38410 Gerrit-PatchSet: 6 Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu>
1 0
0 0
[XL] Change in osmo-msc[master]: vlr: drop msc/debug.h header
by lynxis lazus 21 Oct '24

21 Oct '24
Attention is currently required from: laforge, lynxis lazus, pespin. Hello Jenkins Builder, laforge, pespin, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-msc/+/38411?usp=email to look at the new patch set (#7). The following approvals got outdated and were removed: Code-Review+1 by laforge, Code-Review+1 by pespin, Verified+1 by Jenkins Builder Change subject: vlr: drop msc/debug.h header ...................................................................... vlr: drop msc/debug.h header Since logging is done different, remove the MSC specific header. Also drop some reference counting logging by a generic DEBUG handler. Change-Id: I8fa2f16c07ef54be3a125c19e0990a68c4d5d2cf --- M src/libvlr/vlr.c M src/libvlr/vlr_access_req_fsm.c M src/libvlr/vlr_auth_fsm.c M src/libvlr/vlr_lu_fsm.c M src/libvlr/vlr_sgs.c M src/libvlr/vlr_sgs_fsm.c M tests/msc_vlr/msc_vlr_test_authen_reuse.err M tests/msc_vlr/msc_vlr_test_call.err M tests/msc_vlr/msc_vlr_test_gsm_authen.err M tests/msc_vlr/msc_vlr_test_gsm_ciph.err M tests/msc_vlr/msc_vlr_test_hlr_reject.err M tests/msc_vlr/msc_vlr_test_hlr_timeout.err M tests/msc_vlr/msc_vlr_test_ms_timeout.err M tests/msc_vlr/msc_vlr_test_no_authen.err M tests/msc_vlr/msc_vlr_test_reject_concurrency.err M tests/msc_vlr/msc_vlr_test_rest.err M tests/msc_vlr/msc_vlr_test_ss.err M tests/msc_vlr/msc_vlr_test_umts_authen.err 18 files changed, 2,493 insertions(+), 2,499 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/11/38411/7 -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/38411?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: I8fa2f16c07ef54be3a125c19e0990a68c4d5d2cf Gerrit-Change-Number: 38411 Gerrit-PatchSet: 7 Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu>
1 0
0 0
[XS] Change in osmo-msc[master]: vlr: make vlr_parq_fsm_init() private
by lynxis lazus 21 Oct '24

21 Oct '24
Attention is currently required from: lynxis lazus. Hello Jenkins Builder, laforge, pespin, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-msc/+/38412?usp=email to look at the new patch set (#7). The following approvals got outdated and were removed: Verified+1 by Jenkins Builder The change is no longer submittable: Verified is unsatisfied now. Change subject: vlr: make vlr_parq_fsm_init() private ...................................................................... vlr: make vlr_parq_fsm_init() private All other fsm initialisation are internal to the libvlr code. Change-Id: I3b4cfc01e6dd5434c74b4fa24a3e0945668b2a74 --- M include/osmocom/vlr/vlr.h M src/libvlr/vlr_access_req_fsm.h 2 files changed, 1 insertion(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/12/38412/7 -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/38412?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: I3b4cfc01e6dd5434c74b4fa24a3e0945668b2a74 Gerrit-Change-Number: 38412 Gerrit-PatchSet: 7 Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu>
1 0
0 0
[M] Change in osmo-ggsn[master]: ggsn: Support announcing APN MTU over PCO
by lynxis lazus 21 Oct '24

21 Oct '24
Attention is currently required from: fixeria, laforge, pespin. lynxis lazus has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/38457?usp=email ) Change subject: ggsn: Support announcing APN MTU over PCO ...................................................................... Patch Set 4: Code-Review-1 (1 comment) Patchset: PS4: Why is this upper limit hardcoded to such low value? Can't you also allow bigger MTU if you want to? Supporting MTU > 1500 might be uncommon, but why not? -- To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/38457?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: I8532acfffadda9e83962b30e4f6b17eb8b3362ac Gerrit-Change-Number: 38457 Gerrit-PatchSet: 4 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: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Mon, 21 Oct 2024 14:41:38 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes
1 0
0 0
[M] Change in osmo-ggsn[master]: ggsn: use libosmocore tundev API to create apn tun device
by pespin 21 Oct '24

21 Oct '24
pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/38480?usp=email ) Change subject: ggsn: use libosmocore tundev API to create apn tun device ...................................................................... Patch Set 2: (1 comment) Patchset: PS2: Depends on https://gerrit.osmocom.org/c/libosmocore/+/38479 being merged before jenkins can +1. -- To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/38480?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: I4d99ba147ac0f3b414d2efef0068b6b8d6cf0014 Gerrit-Change-Number: 38480 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-Comment-Date: Mon, 21 Oct 2024 13:56:17 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No
1 0
0 0
[M] Change in osmo-ggsn[master]: ggsn: use libosmocore tundev API to create apn tun device
by pespin 21 Oct '24

21 Oct '24
pespin has uploaded a new patch set (#2). ( https://gerrit.osmocom.org/c/osmo-ggsn/+/38480?usp=email ) Change subject: ggsn: use libosmocore tundev API to create apn tun device ...................................................................... ggsn: use libosmocore tundev API to create apn tun device This way we can start dropping old osmo-ggsn specific API, avoiding duplication of code. Moreover, the osmo-ggsn code is using older ioctl APIs, which are discouraged nowadays in favour of netlink, which osmo_tundev/osmo_netdev from libosmocore is used. Even better, we win for free non-blocking write behavior in the tundev when switching to the new API, since it already has its own internal wqueue. While doing this, BSD code is dropped since anyway it's not been maintained for a long time. If needed, the BSD support can be added to libosmocore osmo_tundev/osmo_netdev API. This is a first step (already working). Follow-up commits will replace the APIs to set up routes and addresses, and later on osmo-ggsn will win support to set MTU on the interface. Furthermore, this will allow easily adding netns support to osmo-ggsn later on if ever needed. Depends: libosmocore.git Change-Id Ia8a7e7ec6d96c7aebc80528236a0e0d035e7f38d Change-Id: I4d99ba147ac0f3b414d2efef0068b6b8d6cf0014 --- M TODO-RELEASE M ggsn/ggsn.c M ggsn/ggsn.h M lib/tun.c M lib/tun.h M sgsnemu/sgsnemu.c 6 files changed, 90 insertions(+), 148 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/80/38480/2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/38480?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: osmo-ggsn Gerrit-Branch: master Gerrit-Change-Id: I4d99ba147ac0f3b414d2efef0068b6b8d6cf0014 Gerrit-Change-Number: 38480 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-CC: Jenkins Builder
1 0
0 0
[M] Change in osmo-ggsn[master]: ggsn: use libosmocore tundev API to create apn tun device
by pespin 21 Oct '24

21 Oct '24
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/38480?usp=email ) Change subject: ggsn: use libosmocore tundev API to create apn tun device ...................................................................... ggsn: use libosmocore tundev API to create apn tun device This way we can start dropping old osmo-ggsn specific API, avoiding duplication of code. Moreover, the osmo-ggsn code is using older ioctl APIs, which are discouraged nowadays in favour of netlink, which osmo_tundev/osmo_netdev from libosmocore is used. While doing this, BSD code is dropped since anyway it's not been maintained for a long time. If needed, the BSD support can be added to libosmocore osmo_tundev/osmo_netdev API. This is a first step (already working). Follow-up commits will replace the APIs to set up routes and addresses, and later on osmo-ggsn will win support to set MTU on the interface. Furthermore, this will allow easily adding netns support to osmo-ggsn later on if ever needed. Change-Id: I4d99ba147ac0f3b414d2efef0068b6b8d6cf0014 --- M TODO-RELEASE M ggsn/ggsn.c M ggsn/ggsn.h M lib/tun.c M lib/tun.h M sgsnemu/sgsnemu.c 6 files changed, 90 insertions(+), 148 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/80/38480/1 diff --git a/TODO-RELEASE b/TODO-RELEASE index 905c234..194885d 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -9,4 +9,5 @@ #library what description / commit summary line libgtp append new field dir_tun_flags in struct pdp_t (older users not using the field should be fine since struct pdp_t is allocated internally) libgtp ABI break new field cb_create_context_ind in struct gsn_t -libgtp new API gtp_set_cb_update_context_ind(), gtp_update_context_resp() \ No newline at end of file +libgtp new API gtp_set_cb_update_context_ind(), gtp_update_context_resp() +libosmocore >1.10.0 osmo_tundev_get_fd() \ No newline at end of file diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c index 19b0132..7967f42 100644 --- a/ggsn/ggsn.c +++ b/ggsn/ggsn.c @@ -62,7 +62,6 @@ LLIST_HEAD(g_ggsn_list); -static int ggsn_tun_fd_cb(struct osmo_fd *fd, unsigned int what); static int cb_tun_ind(struct tun_t *tun, void *pack, unsigned len); void ggsn_close_one_pdp(struct pdp_t *pdp) @@ -150,7 +149,6 @@ if (apn->cfg.gtpu_mode == APN_GTPU_MODE_TUN) { /* release tun device */ LOGPAPN(LOGL_INFO, apn, "Closing TUN device %s\n", apn->tun.tun->devname); - osmo_fd_unregister(&apn->tun.fd); } tun_free(apn->tun.tun); apn->tun.tun = NULL; @@ -234,10 +232,6 @@ } LOGPAPN(LOGL_INFO, apn, "Opened TUN device %s\n", apn->tun.tun->devname); - /* Register with libosmocore */ - osmo_fd_setup(&apn->tun.fd, apn->tun.tun->fd, OSMO_FD_READ, ggsn_tun_fd_cb, apn, 0); - osmo_fd_register(&apn->tun.fd); - /* Set TUN library callback */ tun_set_cb_ind(apn->tun.tun, cb_tun_ind); break; @@ -799,16 +793,6 @@ return tun_encaps((struct tun_t *)pdp->ipif, pack, len); } -/* callback for tun device osmocom select loop integration */ -static int ggsn_tun_fd_cb(struct osmo_fd *fd, unsigned int what) -{ - struct apn_ctx *apn = fd->data; - - OSMO_ASSERT(what & OSMO_FD_READ); - - return tun_decaps(apn->tun.tun); -} - /* callback for libgtp osmocom select loop integration */ static int ggsn_gtp_fd_cb(struct osmo_fd *fd, unsigned int what) { diff --git a/ggsn/ggsn.h b/ggsn/ggsn.h index a212a06..28f9d04 100644 --- a/ggsn/ggsn.h +++ b/ggsn/ggsn.h @@ -103,7 +103,6 @@ char *ipdown_script; } cfg; struct tun_t *tun; - struct osmo_fd fd; } tun; /* ipv6 link-local address */ diff --git a/lib/tun.c b/lib/tun.c index cb66fef..acc3927 100644 --- a/lib/tun.c +++ b/lib/tun.c @@ -41,20 +41,9 @@ #include <net/route.h> #include <net/if.h> -#if defined(__linux__) #include <linux/if_tun.h> -#elif defined (__FreeBSD__) -#include <net/if_tun.h> -#include <net/if_var.h> -#include <netinet/in_var.h> - -#elif defined (__APPLE__) -#include <net/if.h> - -#else -#error "Unknown platform!" -#endif +#include <osmocom/core/msgb.h> #include "tun.h" #include "syserr.h" @@ -155,121 +144,93 @@ } } +static int tun_tundev_data_ind_cb(struct osmo_tundev *tundev, struct msgb *msg) +{ + struct tun_t *tun = osmo_tundev_get_priv_data(tundev); + int rc = 0; + if (tun->cb_ind) + rc = tun->cb_ind(tun, msgb_data(msg), msgb_length(msg)); + msgb_free(msg); + return rc; +} + int tun_new(struct tun_t **tun, const char *dev_name, bool use_kernel, int fd0, int fd1u) { + struct tun_t *t; + int rc; -#if defined(__linux__) - struct ifreq ifr; - -#elif defined(__FreeBSD__) || defined (__APPLE__) - char devname[IFNAMSIZ + 5]; /* "/dev/" + ifname */ - int devnum; - struct ifaliasreq areq; - int fd; -#endif - - if (!(*tun = calloc(1, sizeof(struct tun_t)))) { - SYS_ERR(DTUN, LOGL_ERROR, errno, "calloc() failed"); + t = talloc_zero(NULL, struct tun_t); + if (!t) { + SYS_ERR(DTUN, LOGL_ERROR, errno, "talloc_zero() failed"); return EOF; } + *tun = t; - (*tun)->cb_ind = NULL; - (*tun)->addrs = 0; - (*tun)->routes = 0; + t->cb_ind = NULL; + t->addrs = 0; + t->routes = 0; + t->fd = -1; -#if defined(__linux__) if (!use_kernel) { - /* Open the actual tun device */ - if (((*tun)->fd = open("/dev/net/tun", O_RDWR)) < 0) { - SYS_ERR(DTUN, LOGL_ERROR, errno, "open() failed"); + osmo_strlcpy(t->devname, dev_name, IFNAMSIZ); + t->devname[IFNAMSIZ - 1] = 0; + + t->tundev = osmo_tundev_alloc(t, dev_name); + if (!t->tundev) goto err_free; - } + osmo_tundev_set_priv_data(t->tundev, t); + osmo_tundev_set_data_ind_cb(t->tundev, tun_tundev_data_ind_cb); + rc = osmo_tundev_set_dev_name(t->tundev, dev_name); + if (rc < 0) + goto err_free_tundev; - /* Set device flags. For some weird reason this is also the method - used to obtain the network interface name */ - memset(&ifr, 0, sizeof(ifr)); - if (dev_name) - strcpy(ifr.ifr_name, dev_name); - ifr.ifr_flags = IFF_TUN | IFF_NO_PI; /* Tun device, no packet info */ - if (ioctl((*tun)->fd, TUNSETIFF, (void *)&ifr) < 0) { - SYS_ERR(DTUN, LOGL_ERROR, errno, "ioctl() failed"); - goto err_close; - } - - strncpy((*tun)->devname, ifr.ifr_name, IFNAMSIZ); - (*tun)->devname[IFNAMSIZ - 1] = 0; + /* Open the actual tun device */ + rc = osmo_tundev_open(t->tundev); + if (rc < 0) + goto err_free; + t->fd = osmo_tundev_get_fd(t->tundev); + t->netdev = osmo_tundev_get_netdev(t->tundev); /* Disable checksums */ - if (ioctl((*tun)->fd, TUNSETNOCSUM, 1) < 0) { - SYS_ERR(DTUN, LOGL_NOTICE, errno, "could not disable checksum on %s", (*tun)->devname); + if (ioctl(t->fd, TUNSETNOCSUM, 1) < 0) { + SYS_ERR(DTUN, LOGL_NOTICE, errno, "could not disable checksum on %s", t->devname); } + + LOGP(DTUN, LOGL_NOTICE, "tun %s configured\n", t->devname); return 0; +err_free_tundev: + osmo_tundev_free(t->tundev); +err_free: + talloc_free(t); + *tun = NULL; + return -1; + } else { - strncpy((*tun)->devname, dev_name, IFNAMSIZ); - (*tun)->devname[IFNAMSIZ - 1] = 0; - (*tun)->fd = -1; + osmo_strlcpy(t->devname, dev_name, IFNAMSIZ); + t->devname[IFNAMSIZ - 1] = 0; if (gtp_kernel_create(-1, dev_name, fd0, fd1u) < 0) { LOGP(DTUN, LOGL_ERROR, "cannot create GTP tunnel device: %s\n", strerror(errno)); return -1; } + t->netdev = osmo_netdev_alloc(t, dev_name); + if (!t->netdev) + goto err_kernel_create; + rc = osmo_netdev_set_ifindex(t->netdev, if_nametoindex(dev_name)); + if (rc < 0) + goto err_netdev_free; + rc = osmo_netdev_register(t->netdev); + if (rc < 0) + goto err_netdev_free; LOGP(DTUN, LOGL_NOTICE, "GTP kernel configured\n"); return 0; - } - -#elif defined(__FreeBSD__) || defined (__APPLE__) - - if (use_kernel) { - LOGP(DTUN, LOGL_ERROR, "No kernel GTP-U support in FreeBSD!\n"); - return -1; - } - - /* Find suitable device */ - for (devnum = 0; devnum < 255; devnum++) { /* TODO 255 */ - snprintf(devname, sizeof(devname), "/dev/tun%d", devnum); - if (((*tun)->fd = open(devname, O_RDWR)) >= 0) - break; - if (errno != EBUSY) - break; - } - if ((*tun)->fd < 0) { - SYS_ERR(DTUN, LOGL_ERROR, errno, - "Can't find tunnel device"); - goto err_free; - } - - snprintf((*tun)->devname, sizeof((*tun)->devname), "tun%d", devnum); - (*tun)->devname[sizeof((*tun)->devname)-1] = 0; - - /* The tun device we found might have "old" IP addresses allocated */ - /* We need to delete those. This problem is not present on Linux */ - - memset(&areq, 0, sizeof(areq)); - - /* Set up interface name */ - strncpy(areq.ifra_name, (*tun)->devname, IFNAMSIZ); - areq.ifra_name[IFNAMSIZ - 1] = 0; /* Make sure to terminate */ - - /* Create a channel to the NET kernel. */ - if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { - SYS_ERR(DTUN, LOGL_ERROR, errno, "socket() failed"); - goto err_close; - } - - /* Delete any IP addresses until SIOCDIFADDR fails */ - while (ioctl(fd, SIOCDIFADDR, (void *)&areq) != -1) ; - - close(fd); - return 0; -#endif - -err_close: - close((*tun)->fd); -err_free: - free(*tun); - *tun = NULL; +err_netdev_free: + osmo_netdev_free(t->netdev); +err_kernel_create: + gtp_kernel_stop(t->devname); return -1; + } } int tun_free(struct tun_t *tun) @@ -279,17 +240,23 @@ netdev_delroute4(&tun->dstaddr.v4, &tun->addr.v4, &tun->netmask); } - if (tun->fd >= 0) { - if (close(tun->fd)) { + if (tun->tundev) { + if (osmo_tundev_close(tun->tundev) < 0) { SYS_ERR(DTUN, LOGL_ERROR, errno, "close() failed"); } + osmo_tundev_free(tun->tundev); + tun->tundev = NULL; + /* netdev is owned by tundev: */ + tun->netdev = NULL; + } else { + /* netdev was allocated directly, free it: */ + osmo_netdev_free(tun->netdev); + tun->netdev = NULL; } gtp_kernel_stop(tun->devname); - /* TODO: For solaris we need to unlink streams */ - - free(tun); + talloc_free(tun); return 0; } @@ -300,30 +267,16 @@ return 0; } -int tun_decaps(struct tun_t *this) -{ - unsigned char buffer[PACKET_MAX]; - int status; - - if ((status = read(this->fd, buffer, sizeof(buffer))) <= 0) { - SYS_ERR(DTUN, LOGL_ERROR, errno, "read() failed"); - return -1; - } - - if (this->cb_ind) - return this->cb_ind(this, buffer, status); - - return 0; -} - int tun_encaps(struct tun_t *tun, void *pack, unsigned len) { + struct msgb *msg = msgb_alloc(PACKET_MAX, "tun_tx"); int rc; - rc = write(tun->fd, pack, len); + + OSMO_ASSERT(msg); + memcpy(msgb_put(msg, len), pack, len); + rc = osmo_tundev_send(tun->tundev, msg); if (rc < 0) { SYS_ERR(DTUN, LOGL_ERROR, errno, "TUN(%s): write() failed", tun->devname); - } else if (rc < len) { - LOGTUN(LOGL_ERROR, tun, "short write() %d < %u\n", rc, len); } return rc; } diff --git a/lib/tun.h b/lib/tun.h index 36a4f7e..8a3a2d4 100644 --- a/lib/tun.h +++ b/lib/tun.h @@ -16,6 +16,9 @@ #include <stdbool.h> #include <net/if.h> +#include <osmocom/core/netdev.h> +#include <osmocom/core/tun.h> + #include "../lib/in46_addr.h" #define PACKET_MAX 8196 /* Maximum packet size we receive */ @@ -30,6 +33,8 @@ *************************************************************/ struct tun_t { + struct osmo_tundev *tundev; + struct osmo_netdev *netdev; int fd; /* File descriptor to tun interface */ struct in46_addr addr; struct in46_addr dstaddr; diff --git a/sgsnemu/sgsnemu.c b/sgsnemu/sgsnemu.c index 152b05b..d6d87b7 100644 --- a/sgsnemu/sgsnemu.c +++ b/sgsnemu/sgsnemu.c @@ -23,6 +23,7 @@ #include <osmocom/core/application.h> #include <osmocom/core/msgb.h> +#include <osmocom/core/select.h> #include <ctype.h> #include <netdb.h> @@ -2186,9 +2187,8 @@ if (!signal_received) { - if ((tun) && FD_ISSET(tun->fd, &fds) && tun_decaps(tun) < 0) { - SYS_ERR(DSGSN, LOGL_ERROR, 0, - "TUN decaps failed"); + if ((tun) && FD_ISSET(tun->fd, &fds)) { + osmo_select_main(1); } if (FD_ISSET(gsn->fd0, &fds)) -- To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/38480?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-ggsn Gerrit-Branch: master Gerrit-Change-Id: I4d99ba147ac0f3b414d2efef0068b6b8d6cf0014 Gerrit-Change-Number: 38480 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1 0
0 0
[M] Change in osmo-ggsn[master]: ggsn: Support announcing APN MTU over PCO
by osmith 21 Oct '24

21 Oct '24
Attention is currently required from: fixeria, laforge, pespin. osmith has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/38457?usp=email ) Change subject: ggsn: Support announcing APN MTU over PCO ...................................................................... Patch Set 4: Code-Review+1 (4 comments) File ggsn/ggsn.h: https://gerrit.osmocom.org/c/osmo-ggsn/+/38457/comment/918dde21_7d6b5cf8?us… : PS4, Line 36: #define IPV6_HDR_MAX_SIZE 40 /* Assume no extension headers in general... */ > Yes because we assume no extension headers used by ipv6, while we account for maximum number of exte […] Acknowledged File ggsn/ggsn_vty.c: https://gerrit.osmocom.org/c/osmo-ggsn/+/38457/comment/c6f120a1_87498701?us… : PS4, Line 425: "mtu (<0-1464>|default)", > It cannot be done, I already tried once. […] Acknowledged https://gerrit.osmocom.org/c/osmo-ggsn/+/38457/comment/bbaf2c97_1cc06fa9?us… : PS4, Line 428: "Default value of the MTU of the APN (1420)") > It cannot be done, I already tried once. […] Acknowledged https://gerrit.osmocom.org/c/osmo-ggsn/+/38457/comment/075fc300_e606542c?us… : PS4, Line 708: vty_out(vty, " mtu %" PRIu16 "%s", apn->cfg.mtu, VTY_NEWLINE); > I'd rather keep it like this, I think it's actually a good idea to always print it, the default is n […] Acknowledged -- To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/38457?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: I8532acfffadda9e83962b30e4f6b17eb8b3362ac Gerrit-Change-Number: 38457 Gerrit-PatchSet: 4 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: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Mon, 21 Oct 2024 12:22:14 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: osmith <osmith(a)sysmocom.de> Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
1 0
0 0
[XS] Change in libosmocore[master]: core/tun.c: Fix documentation in ret of osmo_tundev_send
by pespin 21 Oct '24

21 Oct '24
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/38478?usp=email ) Change subject: core/tun.c: Fix documentation in ret of osmo_tundev_send ...................................................................... core/tun.c: Fix documentation in ret of osmo_tundev_send Change-Id: Id66f77774ed36593201fd5c54a1b29cc7651772b --- M src/core/tun.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/78/38478/1 diff --git a/src/core/tun.c b/src/core/tun.c index 8612819..ec68a96 100644 --- a/src/core/tun.c +++ b/src/core/tun.c @@ -556,7 +556,7 @@ /*! Submit a packet to the tunnel device managed by the tundev object * \param[in] tundev The tundev object owning the tunnel device where to inject the packet * \param[in] msg The msgb containg the packet to transfer - * \returns The current value of the configured network namespace + * \returns 0 on success; negative on error * * This function takes the ownership of msg in all cases. */ -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/38478?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Id66f77774ed36593201fd5c54a1b29cc7651772b Gerrit-Change-Number: 38478 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1 0
0 0
[S] Change in libosmocore[master]: core/tun: Add API osmo_tundev_get_fd
by pespin 21 Oct '24

21 Oct '24
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/38479?usp=email ) Change subject: core/tun: Add API osmo_tundev_get_fd ...................................................................... core/tun: Add API osmo_tundev_get_fd Change-Id: Ia8a7e7ec6d96c7aebc80528236a0e0d035e7f38d --- M TODO-RELEASE M include/osmocom/core/tun.h M src/core/libosmocore.map M src/core/tun.c 4 files changed, 13 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/79/38479/1 diff --git a/TODO-RELEASE b/TODO-RELEASE index 8a1e0dc..b3e4742 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -9,3 +9,4 @@ #library what description / commit summary line gb ADD add bssgp_parse_cell_id2/bssgp_create_cell_id2 gsm ADD add osmo_rai_to_gprs/gprs_rai_to_osmo +core ADD add API osmo_tundev_get_fd() \ No newline at end of file diff --git a/include/osmocom/core/tun.h b/include/osmocom/core/tun.h index 86bd8df..21e7703 100644 --- a/include/osmocom/core/tun.h +++ b/include/osmocom/core/tun.h @@ -29,6 +29,8 @@ const char *osmo_tundev_get_name(const struct osmo_tundev *tundev); +int osmo_tundev_get_fd(const struct osmo_tundev *tundev); + int osmo_tundev_set_dev_name(struct osmo_tundev *tundev, const char *dev_name); const char *osmo_tundev_get_dev_name(const struct osmo_tundev *tundev); diff --git a/src/core/libosmocore.map b/src/core/libosmocore.map index c5ab6e3..c48a2b9 100644 --- a/src/core/libosmocore.map +++ b/src/core/libosmocore.map @@ -569,6 +569,7 @@ osmo_tundev_close; osmo_tundev_free; osmo_tundev_get_dev_name; +osmo_tundev_get_fd; osmo_tundev_get_name; osmo_tundev_get_netdev; osmo_tundev_get_netns_name; diff --git a/src/core/tun.c b/src/core/tun.c index ec68a96..04a1972 100644 --- a/src/core/tun.c +++ b/src/core/tun.c @@ -489,6 +489,15 @@ return tundev->name; } +/*! Get FD associated to the tundev object. + * \param[in] tundev The tundev object from where to retrieve the field + * \returns The fd of the currently open tundev, negative otherwise + */ +int osmo_tundev_get_fd(const struct osmo_tundev *tundev) +{ + return tundev->wqueue.bfd.fd; +} + /*! Set name used to name the tunnel interface created by the tundev object. * \param[in] tundev The tundev object where the field is set * \param[in] dev_name The tunnel interface name to use -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/38479?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ia8a7e7ec6d96c7aebc80528236a0e0d035e7f38d Gerrit-Change-Number: 38479 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • ...
  • 164
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.