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
[M] Change in osmo-ggsn[master]: Refactor tun_t fields and alloc APIs
by pespin 25 Oct '24

25 Oct '24
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/38524?usp=email ) Change subject: Refactor tun_t fields and alloc APIs ...................................................................... Refactor tun_t fields and alloc APIs The previous state of code made allocation code more complex for no good reason; use usual alloc() type function instead, splitting between the 2 types of tun_t implementations available to make it easier to understand. Move the several tun-iface specific mode fields to a substruct to make it clear those are only really containing useful information when the tun_t is created in tun-iface mode. Change-Id: Ic71f91c62cd5bd48c6d35534eaac2091e4c69735 --- M ggsn/ggsn.c M lib/tun.c M lib/tun.h M sgsnemu/sgsnemu.c 4 files changed, 109 insertions(+), 84 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved osmith: Looks good to me, but someone else must approve fixeria: Looks good to me, but someone else must approve diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c index 062e542..329b15f 100644 --- a/ggsn/ggsn.c +++ b/ggsn/ggsn.c @@ -226,7 +226,8 @@ switch (apn->cfg.gtpu_mode) { case APN_GTPU_MODE_TUN: LOGPAPN(LOGL_INFO, apn, "Opening TUN device %s\n", apn->tun.cfg.dev_name); - if (tun_new(&apn->tun.tun, apn->tun.cfg.dev_name, false, -1, -1)) { + apn->tun.tun = tun_alloc_tundev(apn->tun.cfg.dev_name); + if (!apn->tun.tun) { LOGPAPN(LOGL_ERROR, apn, "Failed to configure tun device\n"); return -1; } @@ -246,7 +247,8 @@ return 0; } /* use GTP kernel module for data packet encapsulation */ - if (tun_new(&apn->tun.tun, apn->tun.cfg.dev_name, true, gsn->fd0, gsn->fd1u)) { + apn->tun.tun = tun_alloc_gtpdev(apn->tun.cfg.dev_name, gsn->fd0, gsn->fd1u); + if (!apn->tun.tun) { LOGPAPN(LOGL_ERROR, apn, "Failed to configure Kernel GTP device\n"); return -1; } diff --git a/lib/tun.c b/lib/tun.c index 3cce3a5..89fe292 100644 --- a/lib/tun.c +++ b/lib/tun.c @@ -93,102 +93,118 @@ return rc; } -int tun_new(struct tun_t **tun, const char *dev_name, bool use_kernel, int fd0, int fd1u) +static struct tun_t *tun_alloc_common(const char *devname) { - struct tun_t *t; + struct tun_t *tun; + + tun = talloc_zero(NULL, struct tun_t); + if (!tun) { + LOGP(DTUN, LOGL_ERROR, "tun_alloc_common() failed\n"); + return NULL; + } + + tun->cb_ind = NULL; + tun->addrs = 0; + tun->tundev.fd = -1; + + osmo_strlcpy(tun->devname, devname, IFNAMSIZ); + tun->devname[IFNAMSIZ - 1] = 0; + + return tun; +} + +struct tun_t *tun_alloc_tundev(const char *devname) +{ + struct tun_t *tun; int rc; - t = talloc_zero(NULL, struct tun_t); - if (!t) { - SYS_ERR(DTUN, LOGL_ERROR, errno, "talloc_zero() failed"); - return EOF; + tun = tun_alloc_common(devname); + if (!tun) + return NULL; + + tun->tundev.tundev = osmo_tundev_alloc(tun, tun->devname); + if (!tun->tundev.tundev) + goto err_free; + osmo_tundev_set_priv_data(tun->tundev.tundev, tun); + osmo_tundev_set_data_ind_cb(tun->tundev.tundev, tun_tundev_data_ind_cb); + rc = osmo_tundev_set_dev_name(tun->tundev.tundev, tun->devname); + if (rc < 0) + goto err_free_tundev; + + /* Open the actual tun device */ + rc = osmo_tundev_open(tun->tundev.tundev); + if (rc < 0) + goto err_free_tundev; + tun->tundev.fd = osmo_tundev_get_fd(tun->tundev.tundev); + tun->netdev = osmo_tundev_get_netdev(tun->tundev.tundev); + + /* Disable checksums */ + if (ioctl(tun->tundev.fd, TUNSETNOCSUM, 1) < 0) { + SYS_ERR(DTUN, LOGL_NOTICE, errno, "could not disable checksum on %s", tun->devname); } - *tun = t; - t->cb_ind = NULL; - t->addrs = 0; - t->fd = -1; + LOGP(DTUN, LOGL_NOTICE, "tun %s configured\n", tun->devname); + return tun; - if (!use_kernel) { - 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; - - /* 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(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); + osmo_tundev_free(tun->tundev.tundev); err_free: - talloc_free(t); - *tun = NULL; - return -1; + talloc_free(tun); + return NULL; +} - } else { - osmo_strlcpy(t->devname, dev_name, IFNAMSIZ); - t->devname[IFNAMSIZ - 1] = 0; +struct tun_t *tun_alloc_gtpdev(const char *devname, int fd0, int fd1u) +{ + struct tun_t *tun; + int rc; - 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; -err_netdev_free: - osmo_netdev_free(t->netdev); -err_kernel_create: - gtp_kernel_stop(t->devname); - return -1; + tun = tun_alloc_common(devname); + if (!tun) + return NULL; + + if (gtp_kernel_create(-1, tun->devname, fd0, fd1u) < 0) { + LOGP(DTUN, LOGL_ERROR, "cannot create GTP tunnel device: %s\n", + strerror(errno)); + goto err_free; } + tun->netdev = osmo_netdev_alloc(tun, tun->devname); + if (!tun->netdev) + goto err_kernel_create; + rc = osmo_netdev_set_ifindex(tun->netdev, if_nametoindex(tun->devname)); + if (rc < 0) + goto err_netdev_free; + rc = osmo_netdev_register(tun->netdev); + if (rc < 0) + goto err_netdev_free; + LOGP(DTUN, LOGL_NOTICE, "GTP kernel configured\n"); + return tun; + +err_netdev_free: + osmo_netdev_free(tun->netdev); +err_kernel_create: + gtp_kernel_stop(tun->devname); +err_free: + talloc_free(tun); + return NULL; } int tun_free(struct tun_t *tun) { - if (tun->tundev) { - if (osmo_tundev_close(tun->tundev) < 0) { - SYS_ERR(DTUN, LOGL_ERROR, errno, "close() failed"); + if (tun->tundev.tundev) { + if (osmo_tundev_close(tun->tundev.tundev) < 0) { + SYS_ERR(DTUN, LOGL_ERROR, errno, "osmo_tundev_close() failed"); } - osmo_tundev_free(tun->tundev); - tun->tundev = NULL; + osmo_tundev_free(tun->tundev.tundev); + tun->tundev.tundev = NULL; /* netdev is owned by tundev: */ tun->netdev = NULL; } else { + gtp_kernel_stop(tun->devname); /* netdev was allocated directly, free it: */ osmo_netdev_free(tun->netdev); tun->netdev = NULL; } - gtp_kernel_stop(tun->devname); - talloc_free(tun); return 0; } @@ -205,7 +221,7 @@ struct msgb *msg; int rc; - if (!tun->tundev) { + if (!tun->tundev.tundev) { LOGTUN(LOGL_ERROR, tun, "Injecting decapsulated packet not supported in kernel gtp mode: %s\n", osmo_hexdump(pack, len)); @@ -215,7 +231,7 @@ msg = msgb_alloc(PACKET_MAX, "tun_tx"); OSMO_ASSERT(msg); memcpy(msgb_put(msg, len), pack, len); - rc = osmo_tundev_send(tun->tundev, msg); + rc = osmo_tundev_send(tun->tundev.tundev, msg); if (rc < 0) { SYS_ERR(DTUN, LOGL_ERROR, errno, "TUN(%s): write() failed", tun->devname); } diff --git a/lib/tun.h b/lib/tun.h index 4d41eb8..eb1bee8 100644 --- a/lib/tun.h +++ b/lib/tun.h @@ -33,9 +33,9 @@ *************************************************************/ struct tun_t { - struct osmo_tundev *tundev; + /* In tun device mode: operates on the tun interface, owned by tun.tundev below. + * In gtp kernel mode: operates on the gtp device, allocated explicitly */ struct osmo_netdev *netdev; - int fd; /* File descriptor to tun interface */ struct in46_addr addr; struct in_addr netmask; int addrs; /* Number of allocated IP addresses */ @@ -43,9 +43,15 @@ int (*cb_ind) (struct tun_t * tun, void *pack, unsigned len); /* to be used by libgtp callers/users (to attach their own private state) */ void *priv; + /* Fields only in use when using the tun device mode: */ + struct { + struct osmo_tundev *tundev; /* Manages the tun interface; NULL on gtp kernel mode */ + int fd; /* File descriptor to tun interface; -1 on gtp kernel mode */ + } tundev; }; -extern int tun_new(struct tun_t **tun, const char *dev_name, bool use_kernel, int fd0, int fd1u); +extern struct tun_t *tun_alloc_tundev(const char *devname); +extern struct tun_t *tun_alloc_gtpdev(const char *devname, int fd0, int fd1u); extern int tun_free(struct tun_t *tun); extern int tun_inject_pkt(struct tun_t *tun, void *pack, unsigned len); diff --git a/sgsnemu/sgsnemu.c b/sgsnemu/sgsnemu.c index d195fab..afa7339 100644 --- a/sgsnemu/sgsnemu.c +++ b/sgsnemu/sgsnemu.c @@ -1905,7 +1905,8 @@ if (options.createif) { printf("Setting up interface\n"); /* Create a tunnel interface */ - if (tun_new((struct tun_t **)&tun, options.tun_dev_name, false, -1, -1)) { + tun = tun_alloc_tundev(options.tun_dev_name); + if (!tun) { SYS_ERR(DSGSN, LOGL_ERROR, 0, "Failed to create tun"); exit(1); @@ -1925,8 +1926,8 @@ #endif tun_set_cb_ind(tun, cb_tun_ind); - if (tun->fd > maxfd) - maxfd = tun->fd; + if (tun->tundev.fd > maxfd) + maxfd = tun->tundev.fd; if (proc_ipv6_conf_write(tun->devname, "accept_ra", "0") < 0) { SYS_ERR(DSGSN, LOGL_ERROR, 0, @@ -2159,7 +2160,7 @@ FD_ZERO(&fds); if (tun) - FD_SET(tun->fd, &fds); + FD_SET(tun->tundev.fd, &fds); FD_SET(gsn->fd0, &fds); FD_SET(gsn->fd1c, &fds); FD_SET(gsn->fd1u, &fds); @@ -2187,7 +2188,7 @@ if (!signal_received) { - if ((tun) && FD_ISSET(tun->fd, &fds)) { + if ((tun) && FD_ISSET(tun->tundev.fd, &fds)) { osmo_select_main(1); } -- To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/38524?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: Ic71f91c62cd5bd48c6d35534eaac2091e4c69735 Gerrit-Change-Number: 38524 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
[S] Change in osmo-ttcn3-hacks[master]: testenv: add proper [testsuite] prepare= support
by fixeria 25 Oct '24

25 Oct '24
Attention is currently required from: osmith. fixeria has posted comments on this change by osmith. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38532?usp=email ) Change subject: testenv: add proper [testsuite] prepare= support ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38532?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: Ia78a4eba061e5e070f156f75eae1dfa4cede1ee3 Gerrit-Change-Number: 38532 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Comment-Date: Fri, 25 Oct 2024 13:46:25 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[M] Change in osmo-ggsn[master]: Refactor tun_t fields and alloc APIs
by pespin 25 Oct '24

25 Oct '24
Attention is currently required from: fixeria. pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/38524?usp=email ) Change subject: Refactor tun_t fields and alloc APIs ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/38524?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: Ic71f91c62cd5bd48c6d35534eaac2091e4c69735 Gerrit-Change-Number: 38524 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-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Fri, 25 Oct 2024 13:46:21 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[M] Change in osmo-ggsn[master]: Refactor tun_t fields and alloc APIs
by pespin 25 Oct '24

25 Oct '24
Attention is currently required from: fixeria. pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/38524?usp=email ) Change subject: Refactor tun_t fields and alloc APIs ...................................................................... Patch Set 1: (1 comment) File lib/tun.c: https://gerrit.osmocom.org/c/osmo-ggsn/+/38524/comment/8fce2ad7_d01ffb50?us… : PS1, Line 111: tun->devname[IFNAMSIZ - 1] = 0; > This is redundant because: […] I'll submit this change in a follow-up commit, since it's really orthogonal to all the refactoring in here (I'm simply moving the code chunk in this commit). -- To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/38524?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: Ic71f91c62cd5bd48c6d35534eaac2091e4c69735 Gerrit-Change-Number: 38524 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-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Fri, 25 Oct 2024 13:46:17 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: testenv: remove dead code for [testsuite] prepare=
by fixeria 25 Oct '24

25 Oct '24
Attention is currently required from: osmith. fixeria has posted comments on this change by osmith. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38531?usp=email ) Change subject: testenv: remove dead code for [testsuite] prepare= ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38531?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I9bed48612fad690f86017c298372dc6cea22b94b Gerrit-Change-Number: 38531 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Comment-Date: Fri, 25 Oct 2024 13:44:55 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: hnbgw: test for RUA Disconnect when there is no CN
by fixeria 25 Oct '24

25 Oct '24
Attention is currently required from: laforge, neels, osmith. fixeria has posted comments on this change by neels. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37809?usp=email ) Change subject: hnbgw: test for RUA Disconnect when there is no CN ...................................................................... Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37809?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I2b5c024a395e736538c0c37db40d34f3b8d99991 Gerrit-Change-Number: 37809 Gerrit-PatchSet: 4 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: osmith <osmith(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Fri, 25 Oct 2024 13:42:24 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in osmo-msc[master]: csd_bs: cosmetic changes to csd_bs_list_to_bearer_cap()
by fixeria 25 Oct '24

25 Oct '24
fixeria has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/osmo-msc/+/38510?usp=email ) Change subject: csd_bs: cosmetic changes to csd_bs_list_to_bearer_cap() ...................................................................... Patch Set 1: (1 comment) Commit Message: https://gerrit.osmocom.org/c/osmo-msc/+/38510/comment/9f26c164_6a681744?usp… : PS1, Line 7: csd_bs: cosmetic changes to csd_bs_list_to_bearer_cap() > Allocating a var in the stack every loop iteration This is incorrect, because a loop does not have its own stack frame, only functions do. This simply reduces the usage scope of a variable, in theory allowing the compiler to optimize code better. The resulting binary may or may not change, depending on the compiler and the `-O` level. > Marking the variable as const So that the compiler can avoid allocating stack memory for it and access `list->bs[i]` directly. By "the way this function behaves though" I meant the output it produces given the same input. Again, we can keep discussing this forever, but the core logic of this function remains unchanged. -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/38510?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: I101f55dfbd0d327269fcce76031a2db265ca2eb9 Gerrit-Change-Number: 38510 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Fri, 25 Oct 2024 13:38:26 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: bsc: testenv: set MTU=1500 for lo
by osmith 25 Oct '24

25 Oct '24
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38546?usp=email ) Change subject: bsc: testenv: set MTU=1500 for lo ...................................................................... bsc: testenv: set MTU=1500 for lo Two tests are failing if the MTU is 65536 instead of 1500. This should be analyzed more and fixed, but first let's adjust the testenv config so the behavior of the test environment is the same as with docker-playground. Related: OS#6602 Change-Id: Ifeda66954263fe8d2637377d0701a2208a19c332 --- A _testenv/data/scripts/podman_set_lo_mtu.sh M _testenv/testenv/podman.py M bsc/testenv_generic.cfg 3 files changed, 14 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/46/38546/1 diff --git a/_testenv/data/scripts/podman_set_lo_mtu.sh b/_testenv/data/scripts/podman_set_lo_mtu.sh new file mode 100755 index 0000000..ed91762 --- /dev/null +++ b/_testenv/data/scripts/podman_set_lo_mtu.sh @@ -0,0 +1,11 @@ +#!/bin/sh -e +# Change the MTU for the loopback device, but only when running in podman (as +# we don't want to just make this change for the host without asking). This +# is used as workaround for OS#6602 where we have some tests that don't pass if +# the MTU=65536, the default of lo. + +MTU="$1" + +if [ "$PODMAN" = 1 ]; then + sudo ip link set dev lo mtu "$1" +fi diff --git a/_testenv/testenv/podman.py b/_testenv/testenv/podman.py index faa1837..4788076 100644 --- a/_testenv/testenv/podman.py +++ b/_testenv/testenv/podman.py @@ -215,6 +215,8 @@ "net.ipv4.conf.all.send_redirects=0", # OS#6575 "--sysctl", "net.ipv4.conf.default.send_redirects=0", # OS#6575 + "-e", + "PODMAN=1", ] if not testenv.args.binary_repo: diff --git a/bsc/testenv_generic.cfg b/bsc/testenv_generic.cfg index d453f55..b4ed393 100644 --- a/bsc/testenv_generic.cfg +++ b/bsc/testenv_generic.cfg @@ -1,4 +1,5 @@ [testsuite] +prepare=podman_set_lo_mtu.sh 1500 # OS#6602 program=BSC_Tests config=BSC_Tests.cfg -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38546?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: Ifeda66954263fe8d2637377d0701a2208a19c332 Gerrit-Change-Number: 38546 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de>
1 0
0 0
[XS] Change in pysim[master]: pySim-shell_test/utils: enumerate pySim-shell logs
by dexter 25 Oct '24

25 Oct '24
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/38544?usp=email ) Change subject: pySim-shell_test/utils: enumerate pySim-shell logs ...................................................................... pySim-shell_test/utils: enumerate pySim-shell logs When pySim-shell is called by a testcase, a logfile is createted. The logfile filename contains the testcase name. However, a testcase may run pySim-shell multiple times. In this case we overwrite the log from previous run. Let's use a counter to generate unique file names for each run, so that we won't lose logs from previous runs. Related: OS#6601 Change-Id: Ib2195d9b2231f74d0a6c4fb28f4889b6c45efb1e --- M tests/pySim-shell_test/utils.py 1 file changed, 3 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/44/38544/1 diff --git a/tests/pySim-shell_test/utils.py b/tests/pySim-shell_test/utils.py index 943eb48..6acbd70 100644 --- a/tests/pySim-shell_test/utils.py +++ b/tests/pySim-shell_test/utils.py @@ -170,6 +170,7 @@ testcasepath = inspect.getfile(self.__class__) testcasename = testcasepath.split("/")[-2] + "." + self._testMethodName print(boxed_heading_str("testcase: " + testcasename)) + self.pysim_shell_log_counter = 0 # Find directories self.test_dir = os.path.dirname(testcasepath) @@ -240,7 +241,8 @@ no_exceptions : fail the testcase in case any exceptions occurred while running pySim_shell """ - logfile_name = "pySim-shell_" + self._testMethodName + ".log" + logfile_name = "pySim-shell_" + self._testMethodName + "_" + str(self.pysim_shell_log_counter) + ".log" + self.pysim_shell_log_counter+=1 # Make sure the script file is available if not os.access(script, os.R_OK): -- To view, visit https://gerrit.osmocom.org/c/pysim/+/38544?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Ib2195d9b2231f74d0a6c4fb28f4889b6c45efb1e Gerrit-Change-Number: 38544 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
1 0
0 0
[XS] Change in pysim[master]: pySim-shell_test/utils: delete log files in general
by dexter 25 Oct '24

25 Oct '24
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/38543?usp=email ) Change subject: pySim-shell_test/utils: delete log files in general ...................................................................... pySim-shell_test/utils: delete log files in general When we get rid of temporary files, we delete those using a wildcard, but for the logs from pySim-shell we explicitly memorize the name of the pySim-shell logfile and delete it later by this explicit name. This is not necessary, let's just delete all log files present using a wildcard. Related: OS#6601 Change-Id: I09dc7e59d1a3dcb68f54e3a8dccb86a1bc6c9ee6 --- M tests/pySim-shell_test/utils.py 1 file changed, 1 insertion(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/43/38543/1 diff --git a/tests/pySim-shell_test/utils.py b/tests/pySim-shell_test/utils.py index fe8386a..943eb48 100644 --- a/tests/pySim-shell_test/utils.py +++ b/tests/pySim-shell_test/utils.py @@ -220,7 +220,7 @@ print("testcase execution done -- cleaning up ...") if not self.keepfiles: os.system("rm -f ./*.tmp") - os.system("rm -f ./" + self.__pySim_shell_logfile_name) + os.system("rm -f ./*.log") for template in self.__templates_generated: os.system("rm -f ./" + template) @@ -241,7 +241,6 @@ """ logfile_name = "pySim-shell_" + self._testMethodName + ".log" - self.__pySim_shell_logfile_name = logfile_name # Make sure the script file is available if not os.access(script, os.R_OK): -- To view, visit https://gerrit.osmocom.org/c/pysim/+/38543?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I09dc7e59d1a3dcb68f54e3a8dccb86a1bc6c9ee6 Gerrit-Change-Number: 38543 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • ...
  • 164
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.