From a6830b30a0093ed2fa9d563445bf67026588a8f2 Mon Sep 17 00:00:00 2001 From: Sukchan Lee Date: Sat, 13 Apr 2024 19:28:36 +0900 Subject: [PATCH] [SMF/UPF] Changes subnet configuration (#2975) The way subnet is set up has changed as shown below. ``` smf: session: - subnet: 10.45.0.1/16 smf: session: - subnet: 10.45.0.0/16 gateway: 10.45.0.1 ``` For more information, please refer to Pull Request #2975. --- configs/310014.yaml.in | 10 +++-- configs/csfb.yaml.in | 10 +++-- configs/examples/5gc-sepp1-999-70.yaml.in | 10 +++-- configs/examples/5gc-sepp2-001-01.yaml.in | 10 +++-- configs/examples/5gc-sepp3-315-010.yaml.in | 10 +++-- configs/examples/5gc-tls-sepp1-999-70.yaml.in | 10 +++-- configs/examples/5gc-tls-sepp2-001-01.yaml.in | 10 +++-- .../examples/5gc-tls-sepp3-315-010.yaml.in | 10 +++-- configs/examples/gnb-001-01-ue-001-01.yaml.in | 10 +++-- .../examples/gnb-001-01-ue-315-010.yaml.in | 10 +++-- configs/examples/gnb-001-01-ue-999-70.yaml.in | 10 +++-- .../examples/gnb-315-010-ue-001-01.yaml.in | 10 +++-- .../examples/gnb-315-010-ue-315-010.yaml.in | 10 +++-- .../examples/gnb-315-010-ue-999-70.yaml.in | 10 +++-- configs/examples/gnb-999-70-ue-001-01.yaml.in | 10 +++-- .../examples/gnb-999-70-ue-315-010.yaml.in | 10 +++-- configs/examples/gnb-999-70-ue-999-70.yaml.in | 10 +++-- configs/non3gpp.yaml.in | 10 +++-- configs/open5gs/smf.yaml.in | 20 +++++---- configs/open5gs/upf.yaml.in | 15 ++++--- configs/sample.yaml.in | 10 +++-- configs/slice.yaml.in | 10 +++-- configs/srsenb.yaml.in | 10 +++-- configs/volte.yaml.in | 10 +++-- configs/vonr.yaml.in | 10 +++-- lib/pfcp/context.c | 44 ++++++++++++++++++- lib/pfcp/context.h | 2 +- 27 files changed, 202 insertions(+), 109 deletions(-) diff --git a/configs/310014.yaml.in b/configs/310014.yaml.in index 4dfdf030b..6c4cefcc5 100644 --- a/configs/310014.yaml.in +++ b/configs/310014.yaml.in @@ -109,8 +109,9 @@ smf: server: - address: 127.0.0.4 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -189,8 +190,9 @@ upf: server: - address: 127.0.0.7 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 metrics: server: - address: 127.0.0.7 diff --git a/configs/csfb.yaml.in b/configs/csfb.yaml.in index d32047148..0688c928e 100644 --- a/configs/csfb.yaml.in +++ b/configs/csfb.yaml.in @@ -142,8 +142,9 @@ smf: server: - address: 127.0.0.4 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -219,8 +220,9 @@ upf: server: - address: 127.0.0.7 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 metrics: server: - address: 127.0.0.7 diff --git a/configs/examples/5gc-sepp1-999-70.yaml.in b/configs/examples/5gc-sepp1-999-70.yaml.in index c0e1312af..0a84d670f 100644 --- a/configs/examples/5gc-sepp1-999-70.yaml.in +++ b/configs/examples/5gc-sepp1-999-70.yaml.in @@ -112,8 +112,9 @@ smf: - address: 127.0.1.4 port: 9090 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -207,8 +208,9 @@ upf: server: - address: 127.0.1.7 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 metrics: server: - address: 127.0.1.7 diff --git a/configs/examples/5gc-sepp2-001-01.yaml.in b/configs/examples/5gc-sepp2-001-01.yaml.in index 46e26d8a5..e8df58235 100644 --- a/configs/examples/5gc-sepp2-001-01.yaml.in +++ b/configs/examples/5gc-sepp2-001-01.yaml.in @@ -112,8 +112,9 @@ smf: - address: 127.0.2.4 port: 9090 session: - - subnet: 10.46.0.1/16 - - subnet: 2001:db8:babe::1/48 + - subnet: 10.46.0.0/16 + gateway: 10.46.0.1 + - subnet: 2001:db8:babe::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -207,9 +208,10 @@ upf: server: - address: 127.0.2.7 session: - - subnet: 10.46.0.1/16 + - subnet: 10.46.0.0/16 + gateway: 10.46.0.1 dev: ogstun2 - - subnet: 2001:db8:babe::1/48 + - subnet: 2001:db8:babe::/48 dev: ogstun2 metrics: server: diff --git a/configs/examples/5gc-sepp3-315-010.yaml.in b/configs/examples/5gc-sepp3-315-010.yaml.in index 8915574e3..cfbb9b7ea 100644 --- a/configs/examples/5gc-sepp3-315-010.yaml.in +++ b/configs/examples/5gc-sepp3-315-010.yaml.in @@ -112,8 +112,9 @@ smf: - address: 127.0.3.4 port: 9090 session: - - subnet: 10.47.0.1/16 - - subnet: 2001:db8:face::1/48 + - subnet: 10.47.0.0/16 + gateway: 10.47.0.1 + - subnet: 2001:db8:face::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -207,9 +208,10 @@ upf: server: - address: 127.0.3.7 session: - - subnet: 10.47.0.1/16 + - subnet: 10.47.0.0/16 + gateway: 10.47.0.1 dev: ogstun3 - - subnet: 2001:db8:face::1/48 + - subnet: 2001:db8:face::/48 dev: ogstun3 metrics: server: diff --git a/configs/examples/5gc-tls-sepp1-999-70.yaml.in b/configs/examples/5gc-tls-sepp1-999-70.yaml.in index 1edd26b7c..523df19c8 100644 --- a/configs/examples/5gc-tls-sepp1-999-70.yaml.in +++ b/configs/examples/5gc-tls-sepp1-999-70.yaml.in @@ -113,8 +113,9 @@ smf: - address: 127.0.1.4 port: 9090 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -208,8 +209,9 @@ upf: server: - address: 127.0.1.7 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 metrics: server: - address: 127.0.1.7 diff --git a/configs/examples/5gc-tls-sepp2-001-01.yaml.in b/configs/examples/5gc-tls-sepp2-001-01.yaml.in index 9170cd726..6a2d189af 100644 --- a/configs/examples/5gc-tls-sepp2-001-01.yaml.in +++ b/configs/examples/5gc-tls-sepp2-001-01.yaml.in @@ -113,8 +113,9 @@ smf: - address: 127.0.2.4 port: 9090 session: - - subnet: 10.46.0.1/16 - - subnet: 2001:db8:babe::1/48 + - subnet: 10.46.0.0/16 + gateway: 10.46.0.1 + - subnet: 2001:db8:babe::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -208,9 +209,10 @@ upf: server: - address: 127.0.2.7 session: - - subnet: 10.46.0.1/16 + - subnet: 10.46.0.0/16 + gateway: 10.46.0.1 dev: ogstun2 - - subnet: 2001:db8:babe::1/48 + - subnet: 2001:db8:babe::/48 dev: ogstun2 metrics: server: diff --git a/configs/examples/5gc-tls-sepp3-315-010.yaml.in b/configs/examples/5gc-tls-sepp3-315-010.yaml.in index 945b2b4c7..86f637e34 100644 --- a/configs/examples/5gc-tls-sepp3-315-010.yaml.in +++ b/configs/examples/5gc-tls-sepp3-315-010.yaml.in @@ -113,8 +113,9 @@ smf: - address: 127.0.3.4 port: 9090 session: - - subnet: 10.47.0.1/16 - - subnet: 2001:db8:face::1/48 + - subnet: 10.47.0.0/16 + gateway: 10.47.0.1 + - subnet: 2001:db8:face::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -208,9 +209,10 @@ upf: server: - address: 127.0.3.7 session: - - subnet: 10.47.0.1/16 + - subnet: 10.47.0.0/16 + gateway: 10.47.0.1 dev: ogstun3 - - subnet: 2001:db8:face::1/48 + - subnet: 2001:db8:face::/48 dev: ogstun3 metrics: server: diff --git a/configs/examples/gnb-001-01-ue-001-01.yaml.in b/configs/examples/gnb-001-01-ue-001-01.yaml.in index 5f132056e..0813ed2ff 100644 --- a/configs/examples/gnb-001-01-ue-001-01.yaml.in +++ b/configs/examples/gnb-001-01-ue-001-01.yaml.in @@ -118,8 +118,9 @@ smf: - address: 127.0.0.4 port: 9090 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -203,8 +204,9 @@ upf: server: - address: 127.0.0.7 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 metrics: server: - address: 127.0.0.7 diff --git a/configs/examples/gnb-001-01-ue-315-010.yaml.in b/configs/examples/gnb-001-01-ue-315-010.yaml.in index 20f8756d6..31f6f263e 100644 --- a/configs/examples/gnb-001-01-ue-315-010.yaml.in +++ b/configs/examples/gnb-001-01-ue-315-010.yaml.in @@ -118,8 +118,9 @@ smf: - address: 127.0.0.4 port: 9090 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -203,8 +204,9 @@ upf: server: - address: 127.0.0.7 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 metrics: server: - address: 127.0.0.7 diff --git a/configs/examples/gnb-001-01-ue-999-70.yaml.in b/configs/examples/gnb-001-01-ue-999-70.yaml.in index 16e2c65ac..71917b2a6 100644 --- a/configs/examples/gnb-001-01-ue-999-70.yaml.in +++ b/configs/examples/gnb-001-01-ue-999-70.yaml.in @@ -116,8 +116,9 @@ smf: - address: 127.0.0.4 port: 9090 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -198,8 +199,9 @@ upf: server: - address: 127.0.0.7 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 metrics: server: - address: 127.0.0.7 diff --git a/configs/examples/gnb-315-010-ue-001-01.yaml.in b/configs/examples/gnb-315-010-ue-001-01.yaml.in index f970f2b8b..64491881f 100644 --- a/configs/examples/gnb-315-010-ue-001-01.yaml.in +++ b/configs/examples/gnb-315-010-ue-001-01.yaml.in @@ -118,8 +118,9 @@ smf: - address: 127.0.0.4 port: 9090 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -203,8 +204,9 @@ upf: server: - address: 127.0.0.7 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 metrics: server: - address: 127.0.0.7 diff --git a/configs/examples/gnb-315-010-ue-315-010.yaml.in b/configs/examples/gnb-315-010-ue-315-010.yaml.in index 30c681a5d..f1e0e7a3d 100644 --- a/configs/examples/gnb-315-010-ue-315-010.yaml.in +++ b/configs/examples/gnb-315-010-ue-315-010.yaml.in @@ -116,8 +116,9 @@ smf: - address: 127.0.0.4 port: 9090 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -198,8 +199,9 @@ upf: server: - address: 127.0.0.7 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 metrics: server: - address: 127.0.0.7 diff --git a/configs/examples/gnb-315-010-ue-999-70.yaml.in b/configs/examples/gnb-315-010-ue-999-70.yaml.in index ff0cbcdef..968fa4aed 100644 --- a/configs/examples/gnb-315-010-ue-999-70.yaml.in +++ b/configs/examples/gnb-315-010-ue-999-70.yaml.in @@ -118,8 +118,9 @@ smf: - address: 127.0.0.4 port: 9090 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -203,8 +204,9 @@ upf: server: - address: 127.0.0.7 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 metrics: server: - address: 127.0.0.7 diff --git a/configs/examples/gnb-999-70-ue-001-01.yaml.in b/configs/examples/gnb-999-70-ue-001-01.yaml.in index 202a5f02c..dbe260da8 100644 --- a/configs/examples/gnb-999-70-ue-001-01.yaml.in +++ b/configs/examples/gnb-999-70-ue-001-01.yaml.in @@ -118,8 +118,9 @@ smf: - address: 127.0.0.4 port: 9090 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -203,8 +204,9 @@ upf: server: - address: 127.0.0.7 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 metrics: server: - address: 127.0.0.7 diff --git a/configs/examples/gnb-999-70-ue-315-010.yaml.in b/configs/examples/gnb-999-70-ue-315-010.yaml.in index dea839c0d..c5e7453c4 100644 --- a/configs/examples/gnb-999-70-ue-315-010.yaml.in +++ b/configs/examples/gnb-999-70-ue-315-010.yaml.in @@ -118,8 +118,9 @@ smf: - address: 127.0.0.4 port: 9090 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -203,8 +204,9 @@ upf: server: - address: 127.0.0.7 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 metrics: server: - address: 127.0.0.7 diff --git a/configs/examples/gnb-999-70-ue-999-70.yaml.in b/configs/examples/gnb-999-70-ue-999-70.yaml.in index b1bd3534b..8f593fa5e 100644 --- a/configs/examples/gnb-999-70-ue-999-70.yaml.in +++ b/configs/examples/gnb-999-70-ue-999-70.yaml.in @@ -116,8 +116,9 @@ smf: - address: 127.0.0.4 port: 9090 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -198,8 +199,9 @@ upf: server: - address: 127.0.0.7 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 metrics: server: - address: 127.0.0.7 diff --git a/configs/non3gpp.yaml.in b/configs/non3gpp.yaml.in index ac0477777..7771c31a8 100644 --- a/configs/non3gpp.yaml.in +++ b/configs/non3gpp.yaml.in @@ -110,8 +110,9 @@ smf: server: - address: 127.0.0.4 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -192,8 +193,9 @@ upf: server: - address: 127.0.0.7 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 metrics: server: - address: 127.0.0.7 diff --git a/configs/open5gs/smf.yaml.in b/configs/open5gs/smf.yaml.in index 96f641bd1..f33f60461 100644 --- a/configs/open5gs/smf.yaml.in +++ b/configs/open5gs/smf.yaml.in @@ -34,8 +34,9 @@ smf: - address: 127.0.0.4 port: 9090 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -327,23 +328,26 @@ smf: # o Specific DNN/APN(e.g 'ims') uses 10.46.0.1/16, 2001:db8:babe::1/48 # (If the UE has unknown DNN/APN(not internet/ims), SMF/UPF will crash.) # session: -# - subnet: 10.45.0.1/16 +# - subnet: 10.45.0.0/16 +# gateway: 10.45.0.1 # dnn: internet -# - subnet: 2001:db8:cafe::1/48 +# - subnet: 2001:db8:cafe::/48 # dnn: internet -# - subnet: 10.46.0.1/16 +# - subnet: 10.46.0.0/16 +# gateway: 10.46.0.1 # dnn: ims -# - subnet: 2001:db8:babe::1/48 +# - subnet: 2001:db8:babe::/48 # dnn: ims # # o Pool Range # session: -# - subnet: 10.45.0.1/16 +# - subnet: 10.45.0.0/16 +# gateway: 10.45.0.1 # range: # - 10.45.0.100-10.45.0.200 # - 10.45.1.100- # - -10.45.0.200 -# - subnet: 2001:db8:cafe::1/48 +# - subnet: 2001:db8:cafe::/48 # range: # - 2001:db8:cafe:a0::0-2001:db8:cafe:b0::0 # - 2001:db8:cafe:c0::0-2001:db8:cafe:d0::0 diff --git a/configs/open5gs/upf.yaml.in b/configs/open5gs/upf.yaml.in index 353d7bb64..5965cb5a9 100644 --- a/configs/open5gs/upf.yaml.in +++ b/configs/open5gs/upf.yaml.in @@ -18,8 +18,9 @@ upf: server: - address: 127.0.0.7 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 metrics: server: - address: 127.0.0.7 @@ -70,14 +71,16 @@ upf: # $ sudo ip addr add 2001:db8:babe::1/48 dev ogstun3 # # session: -# - subnet: 10.45.0.1/16 +# - subnet: 10.45.0.0/16 +# gateway: 10.45.0.1 # dnn: internet -# - subnet: 2001:db8:cafe::1/48 +# - subnet: 2001:db8:cafe::/48 # dnn: internet # dev: ogstun2 -# - subnet: 10.46.0.1/16 +# - subnet: 10.46.0.0/16 +# gateway: 10.46.0.1 # dnn: ims # dev: ogstun3 -# - subnet: 2001:db8:babe::1/48 +# - subnet: 2001:db8:babe::/48 # dnn: ims # dev: ogstun3 diff --git a/configs/sample.yaml.in b/configs/sample.yaml.in index 2e7cfb8bd..0ba574232 100644 --- a/configs/sample.yaml.in +++ b/configs/sample.yaml.in @@ -118,8 +118,9 @@ smf: - address: 127.0.0.4 port: 9090 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -203,8 +204,9 @@ upf: server: - address: 127.0.0.7 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 metrics: server: - address: 127.0.0.7 diff --git a/configs/slice.yaml.in b/configs/slice.yaml.in index 87a273133..6e6944085 100644 --- a/configs/slice.yaml.in +++ b/configs/slice.yaml.in @@ -110,8 +110,9 @@ smf: server: - address: 127.0.0.4 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -194,8 +195,9 @@ upf: server: - address: 127.0.0.7 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 metrics: server: - address: 127.0.0.7 diff --git a/configs/srsenb.yaml.in b/configs/srsenb.yaml.in index 113c2177e..2948f0f07 100644 --- a/configs/srsenb.yaml.in +++ b/configs/srsenb.yaml.in @@ -107,8 +107,9 @@ smf: server: - address: 127.0.0.4 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -184,8 +185,9 @@ upf: server: - address: 127.0.0.7 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 metrics: server: - address: 127.0.0.7 diff --git a/configs/volte.yaml.in b/configs/volte.yaml.in index a2f1106dc..36ec7c3d2 100644 --- a/configs/volte.yaml.in +++ b/configs/volte.yaml.in @@ -107,8 +107,9 @@ smf: server: - address: 127.0.0.4 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -187,8 +188,9 @@ upf: server: - address: 127.0.0.7 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 metrics: server: - address: 127.0.0.7 diff --git a/configs/vonr.yaml.in b/configs/vonr.yaml.in index 9108f0bcc..070b9d365 100644 --- a/configs/vonr.yaml.in +++ b/configs/vonr.yaml.in @@ -110,8 +110,9 @@ smf: server: - address: 127.0.0.4 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 dns: - 8.8.8.8 - 8.8.4.4 @@ -193,8 +194,9 @@ upf: server: - address: 127.0.0.7 session: - - subnet: 10.45.0.1/16 - - subnet: 2001:db8:cafe::1/48 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 metrics: server: - address: 127.0.0.7 diff --git a/lib/pfcp/context.c b/lib/pfcp/context.c index 36860553d..9252ef0d5 100644 --- a/lib/pfcp/context.c +++ b/lib/pfcp/context.c @@ -743,6 +743,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote) do { ogs_pfcp_subnet_t *subnet = NULL; const char *ipstr = NULL; + const char *gateway = NULL; const char *mask_or_numbits = NULL; const char *dnn = NULL; const char *dev = self.tun_ifname; @@ -781,6 +782,8 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote) mask_or_numbits = (const char *)v; } } + } else if (!strcmp(subnet_key, "gateway")) { + gateway = ogs_yaml_iter_value(&subnet_iter); } else if (!strcmp(subnet_key, "apn") || !strcmp(subnet_key, "dnn")) { dnn = ogs_yaml_iter_value(&subnet_iter); @@ -825,7 +828,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote) } subnet = ogs_pfcp_subnet_add( - ipstr, mask_or_numbits, dnn, dev); + ipstr, mask_or_numbits, gateway, dnn, dev); ogs_assert(subnet); subnet->num_of_range = num; @@ -2150,7 +2153,7 @@ ogs_pfcp_dev_t *ogs_pfcp_dev_find_by_ifname(const char *ifname) ogs_pfcp_subnet_t *ogs_pfcp_subnet_add( const char *ipstr, const char *mask_or_numbits, - const char *dnn, const char *ifname) + const char *gateway, const char *dnn, const char *ifname) { int rv; ogs_pfcp_dev_t *dev = NULL; @@ -2179,6 +2182,43 @@ ogs_pfcp_subnet_t *ogs_pfcp_subnet_add( subnet->family = subnet->gw.family; subnet->prefixlen = atoi(mask_or_numbits); + + if (memcmp(subnet->gw.sub, subnet->sub.sub, + sizeof(subnet->gw.sub)) != 0) { + char *subnet_string = NULL; + + if (subnet->family == AF_INET) { + subnet_string = ogs_ipv4_to_string(subnet->sub.sub[0]); + ogs_assert(subnet_string); + } else if (subnet->family == AF_INET6) { + subnet_string = ogs_ipv6addr_to_string( + (uint8_t*)&subnet->sub.sub[0]); + ogs_assert(subnet_string); + } + + ogs_warn("Please change the configuration files of " + "smf.yaml and upf.yaml as below."); + ogs_log_print(OGS_LOG_WARN, "\n\n"); + ogs_log_print(OGS_LOG_WARN, "smf:\n"); + ogs_log_print(OGS_LOG_WARN, " session:\n"); + ogs_log_print(OGS_LOG_WARN, " - subnet: %s/%s\n", + ipstr, mask_or_numbits); + ogs_log_print(OGS_LOG_WARN, "\n\n"); + ogs_log_print(OGS_LOG_WARN, "smf:\n"); + ogs_log_print(OGS_LOG_WARN, " session:\n"); + ogs_log_print(OGS_LOG_WARN, " - subnet: %s/%s\n", + subnet_string ? subnet_string : "Unknown", mask_or_numbits); + if (subnet->family == AF_INET) + ogs_log_print(OGS_LOG_WARN, " gateway: %s", ipstr); + ogs_log_print(OGS_LOG_WARN, "\n\n\n"); + + ogs_free(subnet_string); + } + } + + if (gateway) { + rv = ogs_ipsubnet(&subnet->gw, gateway, NULL); + ogs_assert(rv == OGS_OK); } if (dnn) diff --git a/lib/pfcp/context.h b/lib/pfcp/context.h index e77cd4869..aea2e64af 100644 --- a/lib/pfcp/context.h +++ b/lib/pfcp/context.h @@ -491,7 +491,7 @@ ogs_pfcp_dev_t *ogs_pfcp_dev_find_by_ifname(const char *ifname); ogs_pfcp_subnet_t *ogs_pfcp_subnet_add( const char *ipstr, const char *mask_or_numbits, - const char *dnn, const char *ifname); + const char *gateway, const char *dnn, const char *ifname); ogs_pfcp_subnet_t *ogs_pfcp_subnet_next(ogs_pfcp_subnet_t *subnet); void ogs_pfcp_subnet_remove(ogs_pfcp_subnet_t *subnet); void ogs_pfcp_subnet_remove_all(void);