aboutsummaryrefslogtreecommitdiffstats
path: root/src/gb/gprs_ns_vty.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-06-06 22:04:20 +0200
committerHarald Welte <laforge@osmocom.org>2020-06-08 21:16:50 +0200
commit057122e466f2420244502f9b069df8f51f8363fd (patch)
tree1f1d280ef46c73299d0becfd391827b2b1084c19 /src/gb/gprs_ns_vty.c
parent383b3bf58b51807b12a8f032fa407a43b025fc18 (diff)
NS: Optionally disable NS-{RESET,BLOCK,UNBLOCK} when using UDP/IP
3GPP TS 48.016 is quite clear in that no NS-{RESET,BLOCK,UNBLOCK} procedures shall be used over an IP based transport. They are only for use in Frame Relay based transport. However, as libosmogb was first developed against ip.access nanoBTS, and their Gb implementation mandates those procedures, we unconditionally implemented those procedures back then. Let's give the user the option of disabling this behavior to become more spec compliant (and interoperate with more other vendors out there). Change-Id: Ic4eba1b4dcbeac00f5879db295e0a9f1a50f71d8
Diffstat (limited to 'src/gb/gprs_ns_vty.c')
-rw-r--r--src/gb/gprs_ns_vty.c62
1 files changed, 42 insertions, 20 deletions
diff --git a/src/gb/gprs_ns_vty.c b/src/gb/gprs_ns_vty.c
index 9cffb71d..bd53f2f1 100644
--- a/src/gb/gprs_ns_vty.c
+++ b/src/gb/gprs_ns_vty.c
@@ -90,6 +90,32 @@ static int config_write_ns(struct vty *vty)
vty_out(vty, "ns%s", VTY_NEWLINE);
+ /* global configuration must be written first, as some of it may be
+ * relevant when creating the NSE/NSVC later below */
+
+ if (vty_nsi->nsip.local_ip) {
+ ia.s_addr = osmo_htonl(vty_nsi->nsip.local_ip);
+ vty_out(vty, " encapsulation udp local-ip %s%s",
+ inet_ntoa(ia), VTY_NEWLINE);
+ }
+ if (vty_nsi->nsip.local_port)
+ vty_out(vty, " encapsulation udp local-port %u%s",
+ vty_nsi->nsip.local_port, VTY_NEWLINE);
+ if (vty_nsi->nsip.dscp)
+ vty_out(vty, " encapsulation udp dscp %d%s",
+ vty_nsi->nsip.dscp, VTY_NEWLINE);
+
+ vty_out(vty, " encapsulation udp use-reset-block-unblock %s%s",
+ vty_nsi->nsip.use_reset_block_unblock ? "enabled" : "disabled", VTY_NEWLINE);
+
+ vty_out(vty, " encapsulation framerelay-gre enabled %u%s",
+ vty_nsi->frgre.enabled ? 1 : 0, VTY_NEWLINE);
+ if (vty_nsi->frgre.local_ip) {
+ ia.s_addr = osmo_htonl(vty_nsi->frgre.local_ip);
+ vty_out(vty, " encapsulation framerelay-gre local-ip %s%s",
+ inet_ntoa(ia), VTY_NEWLINE);
+ }
+
llist_for_each_entry(nsvc, &vty_nsi->gprs_nsvcs, list) {
if (!nsvc->persistent)
continue;
@@ -130,26 +156,6 @@ static int config_write_ns(struct vty *vty)
get_value_string(gprs_ns_timer_strs, i),
vty_nsi->timeout[i], VTY_NEWLINE);
- if (vty_nsi->nsip.local_ip) {
- ia.s_addr = osmo_htonl(vty_nsi->nsip.local_ip);
- vty_out(vty, " encapsulation udp local-ip %s%s",
- inet_ntoa(ia), VTY_NEWLINE);
- }
- if (vty_nsi->nsip.local_port)
- vty_out(vty, " encapsulation udp local-port %u%s",
- vty_nsi->nsip.local_port, VTY_NEWLINE);
- if (vty_nsi->nsip.dscp)
- vty_out(vty, " encapsulation udp dscp %d%s",
- vty_nsi->nsip.dscp, VTY_NEWLINE);
-
- vty_out(vty, " encapsulation framerelay-gre enabled %u%s",
- vty_nsi->frgre.enabled ? 1 : 0, VTY_NEWLINE);
- if (vty_nsi->frgre.local_ip) {
- ia.s_addr = osmo_htonl(vty_nsi->frgre.local_ip);
- vty_out(vty, " encapsulation framerelay-gre local-ip %s%s",
- inet_ntoa(ia), VTY_NEWLINE);
- }
-
return CMD_SUCCESS;
}
@@ -500,6 +506,21 @@ DEFUN(cfg_nsip_dscp, cfg_nsip_dscp_cmd,
return CMD_SUCCESS;
}
+DEFUN(cfg_nsip_res_block_unblock, cfg_nsip_res_block_unblock_cmd,
+ "encapsulation udp use-reset-block-unblock (enabled|disabled)",
+ ENCAPS_STR "NS over UDP Encapsulation\n"
+ "Use NS-{RESET,BLOCK,UNBLOCK} procedures in violation of 3GPP TS 48.016\n"
+ "Enable NS-{RESET,BLOCK,UNBLOCK}\n"
+ "Disable NS-{RESET,BLOCK,UNBLOCK}\n")
+{
+ if (!strcmp(argv[0], "enabled"))
+ vty_nsi->nsip.use_reset_block_unblock = true;
+ else
+ vty_nsi->nsip.use_reset_block_unblock = false;
+
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_frgre_local_ip, cfg_frgre_local_ip_cmd,
"encapsulation framerelay-gre local-ip A.B.C.D",
ENCAPS_STR "NS over Frame Relay over GRE Encapsulation\n"
@@ -643,6 +664,7 @@ int gprs_ns_vty_init(struct gprs_ns_inst *nsi)
install_element(L_NS_NODE, &cfg_nsip_local_ip_cmd);
install_element(L_NS_NODE, &cfg_nsip_local_port_cmd);
install_element(L_NS_NODE, &cfg_nsip_dscp_cmd);
+ install_element(L_NS_NODE, &cfg_nsip_res_block_unblock_cmd);
install_element(L_NS_NODE, &cfg_frgre_enable_cmd);
install_element(L_NS_NODE, &cfg_frgre_local_ip_cmd);