Change in libosmo-abis[master]: e1_input: Allow (vty) configuration of IP DSCP and socket priority

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Wed Apr 28 16:42:55 UTC 2021


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-abis/+/23958 )


Change subject: e1_input: Allow (vty) configuration of IP DSCP and socket priority
......................................................................

e1_input: Allow (vty) configuration of IP DSCP and socket priority

Change-Id: I8991dd6eb406a5b9a70498974fc1ad339452f871
Related: SYS#5427
---
M include/internal.h
M src/e1_input_vty.c
M src/input/ipaccess.c
3 files changed, 74 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/58/23958/1

diff --git a/include/internal.h b/include/internal.h
index aeca02f..d0d5e23 100644
--- a/include/internal.h
+++ b/include/internal.h
@@ -10,6 +10,19 @@
 struct e1inp_sign_link;
 struct e1inp_ts;
 
+struct ipa_proto_pars {
+	uint8_t dscp;
+	uint8_t priority;
+};
+
+struct ipa_pars {
+	struct ipa_proto_pars oml;
+	struct ipa_proto_pars rsl;
+};
+
+/* global parameters of IPA input driver */
+extern struct ipa_pars g_e1inp_ipaccess_pars;
+
 /* talloc context for libosmo-abis. */
 extern void *libosmo_abis_ctx;
 
@@ -19,6 +32,11 @@
 void e1inp_ipa_set_bind_addr(const char *ip_bind_addr);
 const char *e1inp_ipa_get_bind_addr(void);
 
+void e1inp_ipa_set_oml_dscp(uint8_t dscp);
+void e1inp_ipa_set_rsl_dscp(uint8_t dscp);
+void e1inp_ipa_set_oml_priority(uint8_t prio);
+void e1inp_ipa_set_rsl_priority(uint8_t prio);
+
 /* ipaccess.c requires these functions defined here */
 struct msgb;
 struct msgb *ipa_msg_alloc(int headroom);
diff --git a/src/e1_input_vty.c b/src/e1_input_vty.c
index d915c19..aa2596c 100644
--- a/src/e1_input_vty.c
+++ b/src/e1_input_vty.c
@@ -1,5 +1,5 @@
 /* E1 vty interface */
-/* (C) 2011 by Harald Welte <laforge at gnumonks.org>
+/* (C) 2011-2021 by Harald Welte <laforge at gnumonks.org>
  * All Rights Reserved
  *
  * SPDX-License-Identifier: AGPL-3.0+
@@ -293,6 +293,38 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN_USRATTR(cfg_ipa_dscp, cfg_ipa_dscp_cmd,
+	      X(OSMO_ABIS_LIB_ATTR_IPA_NEW_LNK),
+	      "ipa dscp (oml|rsl) <0-63>",
+	      "ipa driver config\n"
+	      "Set IP DSCP value for outbound packets\n"
+	      "Set IP DSCP for OML link\n"
+	      "Set IP DSCP for RSL link\n"
+	      "IP DSCP Value to use\n")
+{
+	if (!strcmp(argv[0], "oml"))
+		g_e1inp_ipaccess_pars.oml.dscp = atoi(argv[1]);
+	else
+		g_e1inp_ipaccess_pars.rsl.dscp = atoi(argv[1]);
+	return CMD_SUCCESS;
+}
+
+DEFUN_USRATTR(cfg_ipa_priority, cfg_ipa_priority_cmd,
+	      X(OSMO_ABIS_LIB_ATTR_IPA_NEW_LNK),
+	      "ipa priority (oml|rsl) <0-255>",
+	      "ipa driver config\n"
+	      "Set socket priority value for outbound packets\n"
+	      "Set socket priority for OML link\n"
+	      "Set socket priority for RSL link\n"
+	      "socket priority value to use (>6 requires CAP_NET_ADMIN)\n")
+{
+	if (!strcmp(argv[0], "oml"))
+		g_e1inp_ipaccess_pars.oml.priority = atoi(argv[1]);
+	else
+		g_e1inp_ipaccess_pars.rsl.priority = atoi(argv[1]);
+	return CMD_SUCCESS;
+}
+
 static int e1inp_config_write(struct vty *vty)
 {
 	struct e1inp_line *line;
@@ -336,6 +368,15 @@
 		vty_out(vty, " ipa bind %s%s",
 			ipa_bind, VTY_NEWLINE);
 
+	if (g_e1inp_ipaccess_pars.oml.dscp)
+		vty_out(vty, " ipa dscp oml %u%s", g_e1inp_ipaccess_pars.oml.dscp, VTY_NEWLINE);
+	if (g_e1inp_ipaccess_pars.rsl.dscp)
+		vty_out(vty, " ipa dscp rsl %u%s", g_e1inp_ipaccess_pars.rsl.dscp, VTY_NEWLINE);
+	if (g_e1inp_ipaccess_pars.oml.priority)
+		vty_out(vty, " ipa priority oml %u%s", g_e1inp_ipaccess_pars.oml.priority, VTY_NEWLINE);
+	if (g_e1inp_ipaccess_pars.rsl.priority)
+		vty_out(vty, " ipa priority rsl %u%s", g_e1inp_ipaccess_pars.rsl.priority, VTY_NEWLINE);
+
 	return CMD_SUCCESS;
 }
 
@@ -491,6 +532,8 @@
 	install_lib_element(L_E1INP_NODE, &cfg_e1_line_no_ipa_keepalive_cmd);
 
 	install_lib_element(L_E1INP_NODE, &cfg_ipa_bind_cmd);
+	install_lib_element(L_E1INP_NODE, &cfg_ipa_dscp_cmd);
+	install_lib_element(L_E1INP_NODE, &cfg_ipa_priority_cmd);
 
 	install_lib_element_ve(&show_e1drv_cmd);
 	install_lib_element_ve(&show_e1line_cmd);
diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index be882a9..e876790 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -1,6 +1,6 @@
 /* OpenBSC Abis input driver for ip.access */
 
-/* (C) 2009 by Harald Welte <laforge at gnumonks.org>
+/* (C) 2009-2021 by Harald Welte <laforge at gnumonks.org>
  * (C) 2010 by Holger Hans Peter Freyther
  * (C) 2010 by On-Waves
  *
@@ -51,6 +51,9 @@
 #include <osmocom/core/backtrace.h>
 #include <osmocom/gsm/ipa.h>
 
+/* global parameters of IPA input driver */
+struct ipa_pars g_e1inp_ipaccess_pars;
+
 static void *tall_ipa_ctx;
 
 #define TS1_ALLOC_SIZE	900
@@ -1041,6 +1044,8 @@
 				"BSC link: %s\n", strerror(errno));
 			return -ENOMEM;
 		}
+		oml_link->dscp = g_e1inp_ipaccess_pars.oml.dscp;
+		oml_link->priority = g_e1inp_ipaccess_pars.oml.priority;
 		if (ipa_server_link_open(oml_link) < 0) {
 			LOGP(DLINP, LOGL_ERROR, "cannot open OML BSC link: %s\n",
 				strerror(errno));
@@ -1055,6 +1060,8 @@
 				"BSC link: %s\n", strerror(errno));
 			return -ENOMEM;
 		}
+		rsl_link->dscp = g_e1inp_ipaccess_pars.rsl.dscp;
+		rsl_link->priority = g_e1inp_ipaccess_pars.rsl.priority;
 		if (ipa_server_link_open(rsl_link) < 0) {
 			LOGP(DLINP, LOGL_ERROR, "cannot open RSL BSC link: %s\n",
 				strerror(errno));
@@ -1087,6 +1094,8 @@
 				"BTS link: %s\n", strerror(errno));
 			return -ENOMEM;
 		}
+		link->dscp = g_e1inp_ipaccess_pars.oml.dscp;
+		link->priority = g_e1inp_ipaccess_pars.oml.priority;
 		if (ipa_client_conn_open(link) < 0) {
 			LOGP(DLINP, LOGL_ERROR, "cannot open OML BTS link: %s\n",
 				strerror(errno));
@@ -1141,6 +1150,8 @@
 			"BTS link: %s\n", strerror(errno));
 		return -ENOMEM;
 	}
+	rsl_link->dscp = g_e1inp_ipaccess_pars.rsl.dscp;
+	rsl_link->priority = g_e1inp_ipaccess_pars.rsl.priority;
 	if (ipa_client_conn_open(rsl_link) < 0) {
 		LOGP(DLINP, LOGL_ERROR, "cannot open RSL BTS link: %s\n",
 			strerror(errno));

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/23958
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I8991dd6eb406a5b9a70498974fc1ad339452f871
Gerrit-Change-Number: 23958
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210428/44107864/attachment.htm>


More information about the gerrit-log mailing list