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
[XS] Change in pysim[master]: TEST, please ignore
by dexter 24 Oct '24

24 Oct '24
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/38526?usp=email ) Change subject: TEST, please ignore ...................................................................... TEST, please ignore Change-Id: I02934ed3eb8728e0f9f5a6cfb2b020b73def7174 --- M tests/pySim-shell_test/config.yaml 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/26/38526/1 diff --git a/tests/pySim-shell_test/config.yaml b/tests/pySim-shell_test/config.yaml index 705d1b4..61b5c7c 100644 --- a/tests/pySim-shell_test/config.yaml +++ b/tests/pySim-shell_test/config.yaml @@ -1,5 +1,5 @@ regenerate: False -keepfiles: False +keepfiles: True print_content: False cards: - name : "sysmoISIM-SJA5-S17" -- To view, visit https://gerrit.osmocom.org/c/pysim/+/38526?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: I02934ed3eb8728e0f9f5a6cfb2b020b73def7174 Gerrit-Change-Number: 38526 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
1 0
0 0
[M] Change in osmo-ggsn[master]: doc: Document MTU features in User Manual and example config files
by osmith 24 Oct '24

24 Oct '24
Attention is currently required from: laforge, lynxis lazus, pespin. osmith has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/38500?usp=email ) Change subject: doc: Document MTU features in User Manual and example config files ...................................................................... Patch Set 11: Code-Review+1 (1 comment) Patchset: PS8: > I'll submit that as a follow-up patch, this way we have history of how to do it using iptables. Done -- To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/38500?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: Ib6e974b38107fe48072380f768e1881f0fc95e80 Gerrit-Change-Number: 38500 Gerrit-PatchSet: 11 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder 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: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Comment-Date: Thu, 24 Oct 2024 15:21:40 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: laforge <laforge(a)osmocom.org> Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
1 0
0 0
[M] Change in osmo-ggsn[master]: doc: Document MTU features in User Manual and example config files
by pespin 24 Oct '24

24 Oct '24
Attention is currently required from: laforge, lynxis lazus, osmith. Hello Jenkins Builder, laforge, lynxis lazus, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-ggsn/+/38500?usp=email to look at the new patch set (#11). The following approvals got outdated and were removed: Verified+1 by Jenkins Builder Change subject: doc: Document MTU features in User Manual and example config files ...................................................................... doc: Document MTU features in User Manual and example config files Related: OS#6298 Related: SYS#7122 Change-Id: Ib6e974b38107fe48072380f768e1881f0fc95e80 --- M doc/examples/osmo-ggsn-kernel-gtp.cfg M doc/examples/osmo-ggsn.cfg M doc/manuals/chapters/configuration.adoc A doc/manuals/chapters/mtu.adoc M doc/manuals/chapters/running.adoc 5 files changed, 200 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/00/38500/11 -- To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/38500?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: Ib6e974b38107fe48072380f768e1881f0fc95e80 Gerrit-Change-Number: 38500 Gerrit-PatchSet: 11 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-CC: osmith <osmith(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu>
1 0
0 0
[M] Change in osmo-ggsn[master]: doc: Document MTU features in User Manual and example config files
by pespin 24 Oct '24

24 Oct '24
Attention is currently required from: laforge, lynxis lazus, osmith. pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/38500?usp=email ) Change subject: doc: Document MTU features in User Manual and example config files ...................................................................... Patch Set 10: (8 comments) File doc/manuals/chapters/mtu.adoc: https://gerrit.osmocom.org/c/osmo-ggsn/+/38500/comment/19e1fed5_8303c9b2?us… : PS10, Line 8: eg > e.g. Done https://gerrit.osmocom.org/c/osmo-ggsn/+/38500/comment/bbaaab35_dba3f638?us… : PS10, Line 29: tehir > their Done https://gerrit.osmocom.org/c/osmo-ggsn/+/38500/comment/862e638c_c7d68f58?us… : PS10, Line 77: ping -M probe 176.16.222.4 -s 1420 > $ ping -M probe 176.16.222. […] Done https://gerrit.osmocom.org/c/osmo-ggsn/+/38500/comment/96e955a1_6db79732?us… : PS10, Line 88: _jubo > _jumbo 🐘 Done https://gerrit.osmocom.org/c/osmo-ggsn/+/38500/comment/fcffee11_738452d2?us… : PS10, Line 89: ineroperability > interoperability Done https://gerrit.osmocom.org/c/osmo-ggsn/+/38500/comment/f3b04b3a_e93c56c3?us… : PS10, Line 102: Hence, following the examples presented on the above sections, one could configure *all the links* which are part of the GTP-U path to use an outer MTU of `1580` bytes, as per the following formula: > wrap this line and the line above? Done https://gerrit.osmocom.org/c/osmo-ggsn/+/38500/comment/d0e384b7_c427f783?us… : PS10, Line 137: inithal > initial Done https://gerrit.osmocom.org/c/osmo-ggsn/+/38500/comment/bf6d56c7_d7902d71?us… : PS10, Line 142: MTu > MTU Done -- To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/38500?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: Ib6e974b38107fe48072380f768e1881f0fc95e80 Gerrit-Change-Number: 38500 Gerrit-PatchSet: 10 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-CC: osmith <osmith(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Comment-Date: Thu, 24 Oct 2024 15:08:30 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: osmith <osmith(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-ggsn[master]: doc: Update all iptables references with nftables
by osmith 24 Oct '24

24 Oct '24
Attention is currently required from: laforge, lynxis lazus, pespin. osmith has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/38525?usp=email ) Change subject: doc: Update all iptables references with nftables ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/38525?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: I3caf316e8ccf1d757b83f7a119271084c55e018c Gerrit-Change-Number: 38525 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder 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: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Comment-Date: Thu, 24 Oct 2024 15:03:37 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[M] Change in osmo-ggsn[master]: doc: Document MTU features in User Manual and example config files
by osmith 24 Oct '24

24 Oct '24
Attention is currently required from: laforge, lynxis lazus, pespin. osmith has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/38500?usp=email ) Change subject: doc: Document MTU features in User Manual and example config files ...................................................................... Patch Set 10: (11 comments) File doc/manuals/chapters/mtu.adoc: https://gerrit.osmocom.org/c/osmo-ggsn/+/38500/comment/0365f201_4c2ff489?us… : PS8, Line 80: outter > https://ih0.redbubble.net/image.396516344.0436/flat,800x800,075,f.u1.jpg […] Done File doc/manuals/chapters/mtu.adoc: https://gerrit.osmocom.org/c/osmo-ggsn/+/38500/comment/096549ca_78bb46cb?us… : PS10, Line 8: eg e.g. https://gerrit.osmocom.org/c/osmo-ggsn/+/38500/comment/039de412_872b683f?us… : PS10, Line 29: tehir their https://gerrit.osmocom.org/c/osmo-ggsn/+/38500/comment/d72c4d7c_c8277cc2?us… : PS10, Line 77: ping -M probe 176.16.222.4 -s 1420 $ ping -M probe 176.16.222.4 -s 1420 https://gerrit.osmocom.org/c/osmo-ggsn/+/38500/comment/51826072_4bbe8b99?us… : PS10, Line 88: _jubo _jumbo 🐘 https://gerrit.osmocom.org/c/osmo-ggsn/+/38500/comment/f4a4c4df_867ec148?us… : PS10, Line 89: ineroperability interoperability https://gerrit.osmocom.org/c/osmo-ggsn/+/38500/comment/2f909576_9e143ad8?us… : PS10, Line 102: Hence, following the examples presented on the above sections, one could configure *all the links* which are part of the GTP-U path to use an outer MTU of `1580` bytes, as per the following formula: wrap this line and the line above? https://gerrit.osmocom.org/c/osmo-ggsn/+/38500/comment/ac23d97f_9ec7fc00?us… : PS10, Line 137: inithal initial https://gerrit.osmocom.org/c/osmo-ggsn/+/38500/comment/49a86953_a0fe9332?us… : PS10, Line 142: MTu MTU File doc/manuals/chapters/running.adoc: https://gerrit.osmocom.org/c/osmo-ggsn/+/38500/comment/13389d8f_f3d3fdbc?us… : PS5, Line 57: When running osmo-ggsn, the user must take network Maximum Transmission Unit : (MTU) into consideration, and configure it based on network specific setup. > I rewrote and restructured the whole thing in the new patch version. Done https://gerrit.osmocom.org/c/osmo-ggsn/+/38500/comment/6e367e2b_60151a6d?us… : PS5, Line 122: OsmOGGSN > "95% of the traffic will be TCP": I think that's no longer the case today. […] Done -- To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/38500?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: Ib6e974b38107fe48072380f768e1881f0fc95e80 Gerrit-Change-Number: 38500 Gerrit-PatchSet: 10 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-CC: osmith <osmith(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> Gerrit-Comment-Date: Thu, 24 Oct 2024 15:01:27 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge <laforge(a)osmocom.org> Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-ggsn[master]: doc: Update all iptables references with nftables
by pespin 24 Oct '24

24 Oct '24
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/38525?usp=email ) Change subject: doc: Update all iptables references with nftables ...................................................................... doc: Update all iptables references with nftables Change-Id: I3caf316e8ccf1d757b83f7a119271084c55e018c --- M doc/examples/firewall M doc/manuals/chapters/mtu.adoc M doc/manuals/chapters/running.adoc 3 files changed, 23 insertions(+), 23 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/25/38525/1 diff --git a/doc/examples/firewall b/doc/examples/firewall index fce735a..d5fadec 100755 --- a/doc/examples/firewall +++ b/doc/examples/firewall @@ -13,36 +13,36 @@ # to and from the Gn interface. # * Masquerede on Gi interface. -IPTABLES="/sbin/iptables" +NFT="nft" IFGN="eth0" IFGI="eth1" -$IPTABLES -P INPUT DROP -$IPTABLES -P FORWARD ACCEPT -$IPTABLES -P OUTPUT ACCEPT +$NFT add chain ip filter input '{ policy drop; }' +$NFT add chain ip filter forward '{ policy accept; }' +$NFT add chain ip filter output '{ policy accept; }' #Allow related and established on all interfaces (input) -$IPTABLES -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT +$NFT add rule ip filter input ct state related,established counter accept #Allow releated, established, GTP and ssh on $IFGN. Reject everything else. -$IPTABLES -A INPUT -i $IFGN -p tcp -m tcp --dport 22 --syn -j ACCEPT -$IPTABLES -A INPUT -i $IFGN -p udp -m udp --dport 2123 -j ACCEPT -$IPTABLES -A INPUT -i $IFGN -p udp -m udp --dport 2152 -j ACCEPT -$IPTABLES -A INPUT -i $IFGN -p udp -m udp --dport 3386 -j ACCEPT -$IPTABLES -A INPUT -i $IFGN -j REJECT +$NFT add rule ip filter input iifname $IFGN tcp dport 22 tcp flags syn / fin,syn,rst,ack counter accept +$NFT add rule ip filter input iifname $IFGN udp dport 2123 counter accept +$NFT add rule ip filter input iifname $IFGN udp dport 2152 counter accept +$NFT add rule ip filter input iifname $IFGN udp dport 3386 counter accept +$NFT add rule ip filter input iifname $IFGN counter reject #Allow related, established and ssh. Drop everything else. -$IPTABLES -A INPUT -i $IFGI -p tcp -m tcp --dport 22 --syn -j ACCEPT -$IPTABLES -A INPUT -i $IFGI -j DROP +$NFT add rule ip filter input iifname $IFGI tcp dport 22 tcp flags syn / fin,syn,rst,ack counter accept +$NFT add rule ip filter input iifname $IFGI counter drop # Masquerade everything going out on $IFGI -$IPTABLES -t nat -A POSTROUTING -o $IFGI -j MASQUERADE +$NFT add rule ip nat POSTROUTING oifname $IFGI counter masquerade #Allow everything on loopback interface. -$IPTABLES -A INPUT -i lo -j ACCEPT +$NFT add rule ip filter input iifname "lo" counter accept # Drop everything to and from $IFGN (forward) -$IPTABLES -A FORWARD -i $IFGN -j DROP -$IPTABLES -A FORWARD -o $IFGN -j DROP +$NFT add rule ip filter forward iifname $IFGN counter drop +$NFT add rule ip filter forward oifname $IFGN counter drop diff --git a/doc/manuals/chapters/mtu.adoc b/doc/manuals/chapters/mtu.adoc index eb323d6..041219f 100644 --- a/doc/manuals/chapters/mtu.adoc +++ b/doc/manuals/chapters/mtu.adoc @@ -146,13 +146,13 @@ MSS = TUNNEL_MTU - IP_HDR - TCP_HDR = 1420 - 60 - 56 = 1304 ---- -In linux, the MSS of TCP connections can be clamped using iptables: +In linux, the MSS of TCP connections can be clamped using nftables: ---- -iptables -t nat -A PREROUTING -p tcp --tcp-flags SYN,RST SYN -i apn0 -j TCPMSS --set-mss 1304 -iptables -t nat -I POSTROUTING -p tcp --tcp-flags SYN,RST SYN -o apn0 -j TCPMSS --set-mss 1304 -ip6tables -t nat -A PREROUTING -p tcp --tcp-flags SYN,RST SYN -i apn0 -j TCPMSS --set-mss 1304 -ip6tables -t nat -I POSTROUTING -p tcp --tcp-flags SYN,RST SYN -o apn0 -j TCPMSS --set-mss 1304 +nft 'add rule ip nat prerouting iifname "apn0" tcp flags syn / syn,rst counter tcp option maxseg size set 1304' +nft 'insert rule ip nat postrouting oifname "apn0" tcp flags syn / syn,rst counter tcp option maxseg size set 1304' +nft 'add rule ip6 nat prerouting iifname "apn0" tcp flags syn / syn,rst counter tcp option maxseg size set 1304' +nft 'insert rule ip6 nat postrouting oifname "apn0" tcp flags syn / syn,rst counter tcp option maxseg size set 1304' ---- ==== Further Reading diff --git a/doc/manuals/chapters/running.adoc b/doc/manuals/chapters/running.adoc index 386b6b5..99fa11d 100644 --- a/doc/manuals/chapters/running.adoc +++ b/doc/manuals/chapters/running.adoc @@ -43,14 +43,14 @@ ---- sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward" -iptables -t nat -A POSTROUTING -o '*' -j MASQUERADE +nft 'add rule ip nat postrouting oifname "\*" counter masquerade' ---- (You may want to replace `*` with the network device name, like `-o eth0`) There are various ways to enable these settings persistently, please refer to your distribution's documentation -- e.g. look for @net.ipv4.ip_forward=1@ in -@/etc/sysctl.d/@, and https://wiki.debian.org/iptables for masquerading. +@/etc/sysctl.d/@, and https://wiki.debian.org/nftables for masquerading. include::{srcdir}/chapters/mtu.adoc[] -- To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/38525?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: I3caf316e8ccf1d757b83f7a119271084c55e018c Gerrit-Change-Number: 38525 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1 0
0 0
[M] Change in pysim[master]: pySim.ts_31_102: Add support for EF.EARFCNList
by dexter 24 Oct '24

24 Oct '24
Attention is currently required from: laforge. dexter has posted comments on this change by laforge. ( https://gerrit.osmocom.org/c/pysim/+/38472?usp=email ) Change subject: pySim.ts_31_102: Add support for EF.EARFCNList ...................................................................... Patch Set 2: (1 comment) Patchset: PS2: As far as I can see at the moment, the reason why this patch fails the tests is that something broke current master, or there is some other error with the tester. I will investigate this. -- To view, visit https://gerrit.osmocom.org/c/pysim/+/38472?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I16797ca58c3ad6ebaf588d04fec011a0cbcfcef3 Gerrit-Change-Number: 38472 Gerrit-PatchSet: 2 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Thu, 24 Oct 2024 14:38:17 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No
1 0
0 0
[M] Change in osmo-ggsn[master]: Refactor tun_t fields and alloc APIs
by osmith 24 Oct '24

24 Oct '24
Attention is currently required from: fixeria, pespin. osmith 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+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: 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: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Thu, 24 Oct 2024 14:08:52 +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 24 Oct '24

24 Oct '24
pespin has uploaded this change for review. ( 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(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/24/38524/1 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: newchange 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>
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • ...
  • 164
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.