Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zebra: add mpls configuration knob per interface #9505

Closed
wants to merge 1 commit into from

Conversation

pguibert6WIND
Copy link
Member

This configuration knob permits to set value of :
proc/sys/net/mpls/conf//input.
Even if underlying interface is not available at the moment of the call.

Signed-off-by: Philippe Guibert philippe.guibert@6wind.com

@LabN-CI
Copy link
Collaborator

LabN-CI commented Aug 27, 2021

Outdated results 💚

Basic BGPD CI results: SUCCESS, 0 tests failed

_ _
Result SUCCESS git merge/9505 9c0a654
Date 08/27/2021
Start 10:11:02
Finish 10:37:24
Run-Time 26:22
Total 1813
Pass 1813
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2021-08-27-10:11:02.txt
Log autoscript-2021-08-27-10:12:14.log.bz2
Memory 512 490 425

For details, please contact louberger

@LabN-CI
Copy link
Collaborator

LabN-CI commented Aug 27, 2021

Outdated results 💚

Basic BGPD CI results: SUCCESS, 0 tests failed

_ _
Result SUCCESS git merge/9505 607f018
Date 08/27/2021
Start 11:16:04
Finish 11:42:25
Run-Time 26:21
Total 1813
Pass 1813
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2021-08-27-11:16:04.txt
Log autoscript-2021-08-27-11:17:16.log.bz2
Memory 490 514 425

For details, please contact louberger

@NetDEF-CI
Copy link
Collaborator

NetDEF-CI commented Aug 27, 2021

Continuous Integration Result: SUCCESSFUL

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-21429/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Warnings Generated during build:

Checkout code: Successful with additional warnings
Report for interface.c | 6 issues
===============================================
< WARNING: externs should be avoided in .c files
< #65: FILE: /tmp/f1-15746/interface.c:65:
< WARNING: Missing a blank line after declarations
< #3856: FILE: /tmp/f1-15746/interface.c:3856:
< WARNING: line over 80 characters
< #4245: FILE: /tmp/f1-15746/interface.c:4245:

@NetDEF-CI
Copy link
Collaborator

NetDEF-CI commented Aug 27, 2021

Continuous Integration Result: FAILED

Continuous Integration Result: FAILED

See below for issues.
CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-21431/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Get source / Pull Request: Successful

Building Stage: Successful

Basic Tests: Failed

Topotests debian 10 amd64 part 9: Failed (click for details)

Topology Test Results are at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-TOPO9DEB10AMD64-21431/test

Topology Tests failed for Topotests debian 10 amd64 part 9:

2021-08-27 15:53:38,458 ERROR: assert failed at "test_ospf_asbr_summary_topo1/test_ospf_type5_summary_tc48_p0": Testcase test_ospf_type5_summary_tc48_p0 : FailedError: Summary missing in OSPF DB
assert '[DUT: r0] OSPF summary 11.0.0.0/8 : External route count is 0, Expected is 5' is True
2021-08-27 15:57:34,682 WARNING: vtysh_cmd: r0: failed to convert json output: : No JSON object could be decoded
2021-08-27 15:57:57,177 WARNING: vtysh_cmd: r1: failed to convert json output: : No JSON object could be decoded
2021-08-27 16:03:46,731 ERROR: r0: bgpd left a dead pidfile (pid=1985)
2021-08-27 16:08:37,526 ERROR: Traceback (most recent call last):
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9DEB10AMD64/topotests/lib/common_config.py", line 1908, in create_interfaces_cfg
    tgen, c_router, interface_data, "interface_config", build=build
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9DEB10AMD64/topotests/lib/common_config.py", line 360, in create_common_configuration
    load_config_to_router(tgen, router)
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9DEB10AMD64/topotests/lib/common_config.py", line 618, in load_config_to_router
    raise InvalidCLIError("%s" % output)
InvalidCLIError: line 3: % Unknown command[16]: ip ospf hello-interval 65536 


2021-08-27 16:08:56,949 ERROR: Traceback (most recent call last):
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9DEB10AMD64/topotests/lib/common_config.py", line 1908, in create_interfaces_cfg
    tgen, c_router, interface_data, "interface_config", build=build
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9DEB10AMD64/topotests/lib/common_config.py", line 360, in create_common_configuration
    load_config_to_router(tgen, router)
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9DEB10AMD64/topotests/lib/common_config.py", line 618, in load_config_to_router
    raise InvalidCLIError("%s" % output)
InvalidCLIError: line 3: % Unknown command[16]: ip ospf dead-interval 65536 

see full log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-21431/artifact/TOPO9DEB10AMD64/ErrorLog/log_topotests.txt

Topotests Ubuntu 18.04 amd64 part 9: Failed (click for details)

Topology Test Results are at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-TOPO9U18AMD64-21431/test

Topology Tests failed for Topotests Ubuntu 18.04 amd64 part 9:

2021-08-27 15:58:00,500 WARNING: vtysh_cmd: r0: failed to convert json output: : No JSON object could be decoded
2021-08-27 15:58:23,216 WARNING: vtysh_cmd: r1: failed to convert json output: : No JSON object could be decoded
2021-08-27 16:02:07,901 ERROR: r3: bgpd left a dead pidfile (pid=8293)
2021-08-27 16:09:26,343 ERROR: Traceback (most recent call last):
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9U18AMD64/topotests/lib/common_config.py", line 1908, in create_interfaces_cfg
    tgen, c_router, interface_data, "interface_config", build=build
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9U18AMD64/topotests/lib/common_config.py", line 360, in create_common_configuration
    load_config_to_router(tgen, router)
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9U18AMD64/topotests/lib/common_config.py", line 618, in load_config_to_router
    raise InvalidCLIError("%s" % output)
InvalidCLIError: line 3: % Unknown command[16]: ip ospf hello-interval 65536 


2021-08-27 16:09:45,305 ERROR: Traceback (most recent call last):
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9U18AMD64/topotests/lib/common_config.py", line 1908, in create_interfaces_cfg
    tgen, c_router, interface_data, "interface_config", build=build
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9U18AMD64/topotests/lib/common_config.py", line 360, in create_common_configuration
    load_config_to_router(tgen, router)
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9U18AMD64/topotests/lib/common_config.py", line 618, in load_config_to_router
    raise InvalidCLIError("%s" % output)
InvalidCLIError: line 3: % Unknown command[16]: ip ospf dead-interval 65536 


2021-08-27 16:40:45,365 ERROR: assert failed at "test_ospfv3_asbr_summary_topo1/test_ospfv3_type5_summary_tc46_p0": Testcase test_ospfv3_type5_summary_tc46_p0 : Failed 
   Error: Routes still present in OSPF RIB True
assert True is not True
2021-08-27 16:48:10,528 ERROR: h1: zebra left a dead pidfile (pid=30266)

see full log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-21431/artifact/TOPO9U18AMD64/ErrorLog/log_topotests.txt

Successful on other platforms/tests
  • Topotests debian 10 amd64 part 3
  • Addresssanitizer topotests part 1
  • Topotests debian 10 amd64 part 8
  • IPv6 protocols on Ubuntu 18.04
  • Topotests Ubuntu 18.04 amd64 part 3
  • Topotests Ubuntu 18.04 amd64 part 5
  • Topotests Ubuntu 18.04 arm8 part 8
  • Topotests Ubuntu 18.04 amd64 part 4
  • IPv4 protocols on Ubuntu 18.04
  • Topotests Ubuntu 18.04 arm8 part 6
  • Topotests Ubuntu 18.04 arm8 part 1
  • Addresssanitizer topotests part 8
  • Addresssanitizer topotests part 3
  • Debian 10 deb pkg check
  • Topotests Ubuntu 18.04 amd64 part 7
  • Topotests Ubuntu 18.04 arm8 part 7
  • Topotests debian 10 amd64 part 7
  • Topotests Ubuntu 18.04 arm8 part 2
  • Addresssanitizer topotests part 6
  • IPv4 ldp protocol on Ubuntu 18.04
  • Ubuntu 20.04 deb pkg check
  • Debian 9 deb pkg check
  • Topotests Ubuntu 18.04 i386 part 0
  • Topotests Ubuntu 18.04 i386 part 5
  • Topotests Ubuntu 18.04 arm8 part 9
  • Topotests Ubuntu 18.04 arm8 part 4
  • CentOS 7 rpm pkg check
  • Topotests Ubuntu 18.04 amd64 part 8
  • Addresssanitizer topotests part 2
  • Topotests Ubuntu 18.04 i386 part 3
  • Topotests Ubuntu 18.04 arm8 part 3
  • Topotests debian 10 amd64 part 5
  • Fedora 29 rpm pkg check
  • Topotests Ubuntu 18.04 i386 part 2
  • Topotests Ubuntu 18.04 i386 part 7
  • Topotests debian 10 amd64 part 1
  • Topotests Ubuntu 18.04 i386 part 8
  • Addresssanitizer topotests part 4
  • Addresssanitizer topotests part 7
  • Topotests debian 10 amd64 part 0
  • Addresssanitizer topotests part 9
  • Topotests debian 10 amd64 part 6
  • Topotests Ubuntu 18.04 amd64 part 2
  • Topotests Ubuntu 18.04 amd64 part 0
  • Addresssanitizer topotests part 5
  • Topotests Ubuntu 18.04 i386 part 4
  • Ubuntu 16.04 deb pkg check
  • Topotests Ubuntu 18.04 i386 part 6
  • Topotests Ubuntu 18.04 i386 part 9
  • Topotests Ubuntu 18.04 arm8 part 0
  • Topotests Ubuntu 18.04 amd64 part 6
  • Topotests debian 10 amd64 part 2
  • Topotests Ubuntu 18.04 i386 part 1
  • Topotests Ubuntu 18.04 arm8 part 5
  • Ubuntu 18.04 deb pkg check
  • Addresssanitizer topotests part 0
  • Topotests Ubuntu 18.04 amd64 part 1
  • Topotests debian 10 amd64 part 4
  • Static analyzer (clang)

Warnings Generated during build:

Checkout code: Successful with additional warnings
Topotests debian 10 amd64 part 9: Failed (click for details)

Topology Test Results are at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-TOPO9DEB10AMD64-21431/test

Topology Tests failed for Topotests debian 10 amd64 part 9:

2021-08-27 15:53:38,458 ERROR: assert failed at "test_ospf_asbr_summary_topo1/test_ospf_type5_summary_tc48_p0": Testcase test_ospf_type5_summary_tc48_p0 : FailedError: Summary missing in OSPF DB
assert '[DUT: r0] OSPF summary 11.0.0.0/8 : External route count is 0, Expected is 5' is True
2021-08-27 15:57:34,682 WARNING: vtysh_cmd: r0: failed to convert json output: : No JSON object could be decoded
2021-08-27 15:57:57,177 WARNING: vtysh_cmd: r1: failed to convert json output: : No JSON object could be decoded
2021-08-27 16:03:46,731 ERROR: r0: bgpd left a dead pidfile (pid=1985)
2021-08-27 16:08:37,526 ERROR: Traceback (most recent call last):
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9DEB10AMD64/topotests/lib/common_config.py", line 1908, in create_interfaces_cfg
    tgen, c_router, interface_data, "interface_config", build=build
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9DEB10AMD64/topotests/lib/common_config.py", line 360, in create_common_configuration
    load_config_to_router(tgen, router)
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9DEB10AMD64/topotests/lib/common_config.py", line 618, in load_config_to_router
    raise InvalidCLIError("%s" % output)
InvalidCLIError: line 3: % Unknown command[16]: ip ospf hello-interval 65536 


2021-08-27 16:08:56,949 ERROR: Traceback (most recent call last):
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9DEB10AMD64/topotests/lib/common_config.py", line 1908, in create_interfaces_cfg
    tgen, c_router, interface_data, "interface_config", build=build
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9DEB10AMD64/topotests/lib/common_config.py", line 360, in create_common_configuration
    load_config_to_router(tgen, router)
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9DEB10AMD64/topotests/lib/common_config.py", line 618, in load_config_to_router
    raise InvalidCLIError("%s" % output)
InvalidCLIError: line 3: % Unknown command[16]: ip ospf dead-interval 65536 

see full log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-21431/artifact/TOPO9DEB10AMD64/ErrorLog/log_topotests.txt

Topotests Ubuntu 18.04 amd64 part 9: Failed (click for details)

Topology Test Results are at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-TOPO9U18AMD64-21431/test

Topology Tests failed for Topotests Ubuntu 18.04 amd64 part 9:

2021-08-27 15:58:00,500 WARNING: vtysh_cmd: r0: failed to convert json output: : No JSON object could be decoded
2021-08-27 15:58:23,216 WARNING: vtysh_cmd: r1: failed to convert json output: : No JSON object could be decoded
2021-08-27 16:02:07,901 ERROR: r3: bgpd left a dead pidfile (pid=8293)
2021-08-27 16:09:26,343 ERROR: Traceback (most recent call last):
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9U18AMD64/topotests/lib/common_config.py", line 1908, in create_interfaces_cfg
    tgen, c_router, interface_data, "interface_config", build=build
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9U18AMD64/topotests/lib/common_config.py", line 360, in create_common_configuration
    load_config_to_router(tgen, router)
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9U18AMD64/topotests/lib/common_config.py", line 618, in load_config_to_router
    raise InvalidCLIError("%s" % output)
InvalidCLIError: line 3: % Unknown command[16]: ip ospf hello-interval 65536 


2021-08-27 16:09:45,305 ERROR: Traceback (most recent call last):
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9U18AMD64/topotests/lib/common_config.py", line 1908, in create_interfaces_cfg
    tgen, c_router, interface_data, "interface_config", build=build
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9U18AMD64/topotests/lib/common_config.py", line 360, in create_common_configuration
    load_config_to_router(tgen, router)
  File "/root/bamboo-agent-home/xml-data/build-dir/FRR-FRRPULLREQ-TOPO9U18AMD64/topotests/lib/common_config.py", line 618, in load_config_to_router
    raise InvalidCLIError("%s" % output)
InvalidCLIError: line 3: % Unknown command[16]: ip ospf dead-interval 65536 


2021-08-27 16:40:45,365 ERROR: assert failed at "test_ospfv3_asbr_summary_topo1/test_ospfv3_type5_summary_tc46_p0": Testcase test_ospfv3_type5_summary_tc46_p0 : Failed 
   Error: Routes still present in OSPF RIB True
assert True is not True
2021-08-27 16:48:10,528 ERROR: h1: zebra left a dead pidfile (pid=30266)

see full log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-21431/artifact/TOPO9U18AMD64/ErrorLog/log_topotests.txt

Report for interface.c | 4 issues
===============================================
< WARNING: externs should be avoided in .c files
< #65: FILE: /tmp/f1-11029/interface.c:65:
< WARNING: line over 80 characters
< #4247: FILE: /tmp/f1-11029/interface.c:4247:

@pguibert6WIND
Copy link
Member Author

ci.rerun

@pguibert6WIND
Copy link
Member Author

ci:rerun

@NetDEF-CI
Copy link
Collaborator

NetDEF-CI commented Aug 28, 2021

Continuous Integration Result: SUCCESSFUL

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-21446/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Warnings Generated during build:

Checkout code: Successful with additional warnings
Report for interface.c | 4 issues
===============================================
< WARNING: externs should be avoided in .c files
< #65: FILE: /tmp/f1-14203/interface.c:65:
< WARNING: line over 80 characters
< #4247: FILE: /tmp/f1-14203/interface.c:4247:

@ton31337
Copy link
Member

Documentation changes?

@qlyoung
Copy link
Member

qlyoung commented Aug 30, 2021

@polychaeta rereview

Copy link

@polychaeta polychaeta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution to FRR!

Click for style suggestions

To apply these suggestions:

curl -s https://gist.githubusercontent.com/polychaeta/dbd981998c8244b5406c145567bd5142/raw/f3e4d116c5e0f0c335377cf96d4d50bcdf882116/cr_9505_1630291653.diff | git apply

diff --git a/lib/mpls.c b/lib/mpls.c
index 14587460a..377be3ffc 100644
--- a/lib/mpls.c
+++ b/lib/mpls.c
@@ -105,8 +105,7 @@ int mpls_interface_set(const char *name, bool val)
 	FILE *fp;
 	int ret = 0, mplsinput = 0;
 
-	snprintf(buf, BUFSIZ,
-		 "/proc/sys/net/mpls/conf/%s/input", name);
+	snprintf(buf, BUFSIZ, "/proc/sys/net/mpls/conf/%s/input", name);
 	fp = fopen(buf, "w");
 	if (fp == NULL)
 		return -1;
diff --git a/zebra/interface.c b/zebra/interface.c
index e2a1deac3..a0fc797c2 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -3770,7 +3770,7 @@ static void mpls_enable_if_set(struct interface *ifp)
 	struct zebra_if *if_data;
 
 	if_data = ifp->info;
-	frr_with_privs(&zserv_privs) {
+	frr_with_privs (&zserv_privs) {
 		vrf_switch_to_netns(ifp->vrf_id);
 		if (if_data->mpls == IF_ZEBRA_MPLS_ON)
 			mpls_interface_set(ifp->name, true);
@@ -3796,11 +3796,8 @@ static int mpls_enable_interface(struct interface *ifp, uint8_t flag)
 	return CMD_SUCCESS;
 }
 
-DEFUN (mpls_enable_if,
-       mpls_enable_if_cmd,
-       "[no] mpls",
-       NO_STR
-       "Enable MPLS traffic reception on this interface\n")
+DEFUN(mpls_enable_if, mpls_enable_if_cmd, "[no] mpls",
+      NO_STR "Enable MPLS traffic reception on this interface\n")
 {
 	int idx = 0;
 	VTY_DECLVAR_CONTEXT(interface, ifp);
@@ -4240,11 +4237,9 @@ static int if_config_write(struct vty *vty)
 								== IF_ZEBRA_MULTICAST_ON
 							? ""
 							: "no ");
-				if (if_data->mpls
-				    != IF_ZEBRA_MPLS_UNSPEC)
+				if (if_data->mpls != IF_ZEBRA_MPLS_UNSPEC)
 					vty_out(vty, " %smpls\n",
-						if_data->mpls
-								== IF_ZEBRA_MPLS_ON
+						if_data->mpls == IF_ZEBRA_MPLS_ON
 							? ""
 							: "no ");
 			}
diff --git a/zebra/interface.h b/zebra/interface.h
index 0643642c8..d344b69eb 100644
--- a/zebra/interface.h
+++ b/zebra/interface.h
@@ -46,8 +46,8 @@ extern "C" {
 
 /* For interface MPLS input configuration */
 #define IF_ZEBRA_MPLS_UNSPEC 0
-#define IF_ZEBRA_MPLS_ON     1
-#define IF_ZEBRA_MPLS_OFF    2
+#define IF_ZEBRA_MPLS_ON 1
+#define IF_ZEBRA_MPLS_OFF 2
 
 #define IF_VLAN_BITMAP_MAX 4096
 

If you are a new contributor to FRR, please see our contributing guidelines.

After making changes, you do not need to create a new PR. You should perform an amend or interactive rebase followed by a force push.

Copy link
Member

@qlyoung qlyoung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@donaldsharp is manually writing to procfs appropriate here? I see your name in the authors, asking you

lib/mpls.c Outdated
FILE *fp;
int ret = 0, mplsinput = 0;

snprintf(buf, BUFSIZ,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sizeof(buf), don't hardcode buffer sizes when you can use sizeof

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you re right. fixing it.

lib/mpls.c Outdated

int mpls_interface_set(const char *name, bool val)
{
char buf[BUFSIZ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this BUFSIZ and not MAXPATHLEN

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you re right. fixing it.

lib/mpls.c Outdated
if (val)
fprintf(fp, "1\n");
else
fprintf(fp, "0\n");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocking comment but fprintf(fp, "%d\n", !!val)? Why branch

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exact. I apply your recommendation.

lib/mpls.c Outdated
* 1 => mpls input is enabled.
* 0 => mpls input is disabled.
*/
if (!fgets(buf, 6, fp))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is 6

Copy link
Member Author

@pguibert6WIND pguibert6WIND Aug 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It it inherited from ipforward_proc.c file. it reads also a proc/sys. in /proc/sys, a 6 bytes sentence was forged. I don' need that. reduced to 2 bytes length.

Copy link

@polychaeta polychaeta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution to FRR!

Click for style suggestions

To apply these suggestions:

curl -s https://gist.githubusercontent.com/polychaeta/8ac6201ac1dcfddf7973aabaf6818fdf/raw/8c395c56d7dc2313af31429a749aa246448becab/cr_9505_1630319271.diff | git apply

diff --git a/lib/mpls.c b/lib/mpls.c
index e26ebf5e5..3af9f794a 100644
--- a/lib/mpls.c
+++ b/lib/mpls.c
@@ -105,8 +105,7 @@ int mpls_interface_set(const char *name, bool val)
 	FILE *fp;
 	int ret = 0, mplsinput = 0;
 
-	snprintf(buf, sizeof(buf),
-		 "/proc/sys/net/mpls/conf/%s/input", name);
+	snprintf(buf, sizeof(buf), "/proc/sys/net/mpls/conf/%s/input", name);
 	fp = fopen(buf, "w");
 	if (fp == NULL)
 		return -1;
diff --git a/zebra/interface.c b/zebra/interface.c
index e2a1deac3..a0fc797c2 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -3770,7 +3770,7 @@ static void mpls_enable_if_set(struct interface *ifp)
 	struct zebra_if *if_data;
 
 	if_data = ifp->info;
-	frr_with_privs(&zserv_privs) {
+	frr_with_privs (&zserv_privs) {
 		vrf_switch_to_netns(ifp->vrf_id);
 		if (if_data->mpls == IF_ZEBRA_MPLS_ON)
 			mpls_interface_set(ifp->name, true);
@@ -3796,11 +3796,8 @@ static int mpls_enable_interface(struct interface *ifp, uint8_t flag)
 	return CMD_SUCCESS;
 }
 
-DEFUN (mpls_enable_if,
-       mpls_enable_if_cmd,
-       "[no] mpls",
-       NO_STR
-       "Enable MPLS traffic reception on this interface\n")
+DEFUN(mpls_enable_if, mpls_enable_if_cmd, "[no] mpls",
+      NO_STR "Enable MPLS traffic reception on this interface\n")
 {
 	int idx = 0;
 	VTY_DECLVAR_CONTEXT(interface, ifp);
@@ -4240,11 +4237,9 @@ static int if_config_write(struct vty *vty)
 								== IF_ZEBRA_MULTICAST_ON
 							? ""
 							: "no ");
-				if (if_data->mpls
-				    != IF_ZEBRA_MPLS_UNSPEC)
+				if (if_data->mpls != IF_ZEBRA_MPLS_UNSPEC)
 					vty_out(vty, " %smpls\n",
-						if_data->mpls
-								== IF_ZEBRA_MPLS_ON
+						if_data->mpls == IF_ZEBRA_MPLS_ON
 							? ""
 							: "no ");
 			}
diff --git a/zebra/interface.h b/zebra/interface.h
index 0643642c8..d344b69eb 100644
--- a/zebra/interface.h
+++ b/zebra/interface.h
@@ -46,8 +46,8 @@ extern "C" {
 
 /* For interface MPLS input configuration */
 #define IF_ZEBRA_MPLS_UNSPEC 0
-#define IF_ZEBRA_MPLS_ON     1
-#define IF_ZEBRA_MPLS_OFF    2
+#define IF_ZEBRA_MPLS_ON 1
+#define IF_ZEBRA_MPLS_OFF 2
 
 #define IF_VLAN_BITMAP_MAX 4096
 

If you are a new contributor to FRR, please see our contributing guidelines.

After making changes, you do not need to create a new PR. You should perform an amend or interactive rebase followed by a force push.

Copy link

@polychaeta polychaeta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution to FRR!

Click for style suggestions

To apply these suggestions:

curl -s https://gist.githubusercontent.com/polychaeta/fc38ff91a668ab73187d4c19a0cff74e/raw/58cf5c3a2d85be907e2a5303aadaf5e3c92cca8e/cr_9505_1630319474.diff | git apply

diff --git a/zebra/interface.c b/zebra/interface.c
index 9b450489d..a0fc797c2 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -3796,8 +3796,8 @@ static int mpls_enable_interface(struct interface *ifp, uint8_t flag)
 	return CMD_SUCCESS;
 }
 
-DEFUN (mpls_enable_if, mpls_enable_if_cmd, "[no] mpls",
-       NO_STR "Enable MPLS traffic reception on this interface\n")
+DEFUN(mpls_enable_if, mpls_enable_if_cmd, "[no] mpls",
+      NO_STR "Enable MPLS traffic reception on this interface\n")
 {
 	int idx = 0;
 	VTY_DECLVAR_CONTEXT(interface, ifp);

If you are a new contributor to FRR, please see our contributing guidelines.

After making changes, you do not need to create a new PR. You should perform an amend or interactive rebase followed by a force push.

@pguibert6WIND
Copy link
Member Author

I recall a discussion with Donald, where I was questioning whether configure mpls sysctl on vty was ok , could be accepted on upstream.
So this is the implem 1 I propose.
I think of an other implem: automatic mode, where mpls flag would be set automatically based on the routes detected on zebra. With some guidance, I could probably implem that automatic mode.

@LabN-CI
Copy link
Collaborator

LabN-CI commented Aug 30, 2021

Outdated results 💚

Basic BGPD CI results: SUCCESS, 0 tests failed

_ _
Result SUCCESS git merge/9505 b6b1852
Date 08/30/2021
Start 06:31:02
Finish 06:57:27
Run-Time 26:25
Total 1813
Pass 1813
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2021-08-30-06:31:02.txt
Log autoscript-2021-08-30-06:32:20.log.bz2
Memory 513 531 420

For details, please contact louberger

@LabN-CI
Copy link
Collaborator

LabN-CI commented Aug 30, 2021

Outdated results 💚

Basic BGPD CI results: SUCCESS, 0 tests failed

_ _
Result SUCCESS git merge/9505 ee59c75
Date 08/30/2021
Start 07:01:03
Finish 07:27:23
Run-Time 26:20
Total 1813
Pass 1813
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2021-08-30-07:01:03.txt
Log autoscript-2021-08-30-07:02:20.log.bz2
Memory 500 512 424

For details, please contact louberger

@pguibert6WIND pguibert6WIND force-pushed the mpls_config branch 2 times, most recently from d9aa0a5 to 2bdccfa Compare August 30, 2021 12:38
@LabN-CI
Copy link
Collaborator

LabN-CI commented Aug 30, 2021

Outdated results 💚

Basic BGPD CI results: SUCCESS, 0 tests failed

_ _
Result SUCCESS git merge/9505 d9aa0a5
Date 08/30/2021
Start 08:26:01
Finish 08:52:18
Run-Time 26:17
Total 1813
Pass 1813
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2021-08-30-08:26:01.txt
Log autoscript-2021-08-30-08:27:13.log.bz2
Memory 514 450 417

For details, please contact louberger

@pguibert6WIND
Copy link
Member Author

@qlyoung, what Donald does is the netlink part of configuring MPLS flag.
I think this piece of code can be brought in for now, then later, the config hooks will be mapped to netlink api.

@NetDEF-CI
Copy link
Collaborator

NetDEF-CI commented Aug 30, 2021

Continuous Integration Result: FAILED

Continuous Integration Result: FAILED

Test incomplete. See below for issues.
CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-21459/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Get source / Pull Request: Successful

Building Stage: Successful

Basic Tests: Incomplete

Addresssanitizer topotests part 8: Incomplete (check logs for details)
Successful on other platforms/tests
  • Addresssanitizer topotests part 6
  • Topotests debian 10 amd64 part 2
  • Ubuntu 16.04 deb pkg check
  • Topotests debian 10 amd64 part 7
  • Debian 10 deb pkg check
  • Topotests Ubuntu 18.04 i386 part 6
  • Topotests Ubuntu 18.04 amd64 part 2
  • Topotests Ubuntu 18.04 i386 part 1
  • Topotests Ubuntu 18.04 arm8 part 8
  • Debian 9 deb pkg check
  • Topotests Ubuntu 18.04 amd64 part 6
  • Ubuntu 18.04 deb pkg check
  • Topotests debian 10 amd64 part 3
  • Ubuntu 20.04 deb pkg check
  • Topotests Ubuntu 18.04 amd64 part 1
  • Topotests Ubuntu 18.04 i386 part 5
  • Addresssanitizer topotests part 3
  • Topotests Ubuntu 18.04 amd64 part 8
  • Addresssanitizer topotests part 2
  • Topotests Ubuntu 18.04 i386 part 8
  • Topotests debian 10 amd64 part 0
  • Topotests Ubuntu 18.04 i386 part 3
  • Topotests debian 10 amd64 part 1
  • Topotests Ubuntu 18.04 arm8 part 7
  • Topotests Ubuntu 18.04 arm8 part 2
  • Addresssanitizer topotests part 9
  • Topotests Ubuntu 18.04 arm8 part 9
  • Topotests Ubuntu 18.04 i386 part 4
  • Addresssanitizer topotests part 7
  • Topotests Ubuntu 18.04 amd64 part 7
  • Topotests Ubuntu 18.04 i386 part 9
  • Topotests Ubuntu 18.04 arm8 part 0
  • Fedora 29 rpm pkg check
  • IPv4 ldp protocol on Ubuntu 18.04
  • Topotests Ubuntu 18.04 arm8 part 5
  • Topotests debian 10 amd64 part 4
  • Addresssanitizer topotests part 0
  • Addresssanitizer topotests part 5
  • Static analyzer (clang)
  • Topotests Ubuntu 18.04 arm8 part 4
  • Topotests debian 10 amd64 part 9
  • Topotests Ubuntu 18.04 i386 part 0
  • IPv6 protocols on Ubuntu 18.04
  • Addresssanitizer topotests part 1
  • CentOS 7 rpm pkg check
  • Topotests debian 10 amd64 part 8
  • Topotests Ubuntu 18.04 amd64 part 3
  • Topotests Ubuntu 18.04 amd64 part 9
  • Topotests Ubuntu 18.04 amd64 part 5
  • Topotests Ubuntu 18.04 arm8 part 3
  • Topotests debian 10 amd64 part 5
  • IPv4 protocols on Ubuntu 18.04
  • Topotests Ubuntu 18.04 arm8 part 6
  • Topotests Ubuntu 18.04 i386 part 2
  • Topotests Ubuntu 18.04 arm8 part 1
  • Topotests Ubuntu 18.04 i386 part 7
  • Topotests debian 10 amd64 part 6
  • Addresssanitizer topotests part 4
  • Topotests Ubuntu 18.04 amd64 part 0
  • Topotests Ubuntu 18.04 amd64 part 4

@NetDEF-CI
Copy link
Collaborator

NetDEF-CI commented Aug 30, 2021

Continuous Integration Result: SUCCESSFUL

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-21460/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Warnings Generated during build:

Checkout code: Successful with additional warnings
Report for interface.c | 6 issues
===============================================
< WARNING: externs should be avoided in .c files
< #65: FILE: /tmp/f1-16664/interface.c:65:
< WARNING: space prohibited between function name and open parenthesis '('
< #3773: FILE: /tmp/f1-16664/interface.c:3773:
< WARNING: line over 80 characters
< #4242: FILE: /tmp/f1-16664/interface.c:4242:

@NetDEF-CI
Copy link
Collaborator

NetDEF-CI commented Aug 30, 2021

Continuous Integration Result: FAILED

Continuous Integration Result: FAILED

See below for issues.
CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-21461/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Get source / Pull Request: Successful

Building Stage: Successful

Basic Tests: Failed

Topotests Ubuntu 18.04 arm8 part 4: Failed (click for details) Topotests Ubuntu 18.04 arm8 part 4: No useful log found
Successful on other platforms/tests
  • Debian 10 deb pkg check
  • Topotests Ubuntu 18.04 arm8 part 2
  • Ubuntu 16.04 deb pkg check
  • Topotests debian 10 amd64 part 7
  • Topotests Ubuntu 18.04 amd64 part 2
  • Topotests Ubuntu 18.04 i386 part 6
  • Topotests debian 10 amd64 part 2
  • Topotests Ubuntu 18.04 arm8 part 8
  • Topotests Ubuntu 18.04 i386 part 1
  • Addresssanitizer topotests part 6
  • Topotests Ubuntu 18.04 amd64 part 6
  • Ubuntu 18.04 deb pkg check
  • Ubuntu 20.04 deb pkg check
  • Debian 9 deb pkg check
  • Topotests Ubuntu 18.04 amd64 part 1
  • Addresssanitizer topotests part 3
  • Topotests debian 10 amd64 part 3
  • Topotests Ubuntu 18.04 amd64 part 8
  • Addresssanitizer topotests part 2
  • Topotests debian 10 amd64 part 0
  • Topotests Ubuntu 18.04 i386 part 8
  • Topotests debian 10 amd64 part 1
  • Topotests Ubuntu 18.04 i386 part 3
  • Addresssanitizer topotests part 9
  • Topotests Ubuntu 18.04 arm8 part 7
  • Topotests Ubuntu 18.04 amd64 part 7
  • Topotests Ubuntu 18.04 amd64 part 0
  • Addresssanitizer topotests part 5
  • Addresssanitizer topotests part 7
  • Topotests Ubuntu 18.04 i386 part 9
  • Topotests Ubuntu 18.04 i386 part 4
  • Topotests Ubuntu 18.04 arm8 part 0
  • Topotests Ubuntu 18.04 arm8 part 5
  • Addresssanitizer topotests part 0
  • IPv4 ldp protocol on Ubuntu 18.04
  • Topotests debian 10 amd64 part 4
  • Static analyzer (clang)
  • Topotests Ubuntu 18.04 arm8 part 9
  • Topotests Ubuntu 18.04 i386 part 0
  • Topotests debian 10 amd64 part 9
  • Topotests Ubuntu 18.04 i386 part 5
  • IPv6 protocols on Ubuntu 18.04
  • CentOS 7 rpm pkg check
  • Addresssanitizer topotests part 1
  • Topotests debian 10 amd64 part 8
  • Topotests Ubuntu 18.04 amd64 part 3
  • Topotests Ubuntu 18.04 amd64 part 9
  • Topotests Ubuntu 18.04 amd64 part 5
  • Fedora 29 rpm pkg check
  • Topotests Ubuntu 18.04 arm8 part 3
  • Addresssanitizer topotests part 8
  • Topotests Ubuntu 18.04 i386 part 2
  • Topotests Ubuntu 18.04 amd64 part 4
  • Topotests debian 10 amd64 part 5
  • Topotests Ubuntu 18.04 i386 part 7
  • Topotests Ubuntu 18.04 arm8 part 6
  • IPv4 protocols on Ubuntu 18.04
  • Addresssanitizer topotests part 4
  • Topotests Ubuntu 18.04 arm8 part 1
  • Topotests debian 10 amd64 part 6

Warnings Generated during build:

Checkout code: Successful with additional warnings
Topotests Ubuntu 18.04 arm8 part 4: Failed (click for details) Topotests Ubuntu 18.04 arm8 part 4: No useful log found
Report for interface.c | 6 issues
===============================================
< WARNING: externs should be avoided in .c files
< #65: FILE: /tmp/f1-26331/interface.c:65:
< WARNING: space prohibited between function name and open parenthesis '('
< #3773: FILE: /tmp/f1-26331/interface.c:3773:
< WARNING: line over 80 characters
< #4242: FILE: /tmp/f1-26331/interface.c:4242:

@LabN-CI
Copy link
Collaborator

LabN-CI commented Aug 30, 2021

Outdated results 💚

Basic BGPD CI results: SUCCESS, 0 tests failed

_ _
Result SUCCESS git merge/9505 2bdccfa
Date 08/30/2021
Start 09:47:22
Finish 10:13:41
Run-Time 26:19
Total 1813
Pass 1813
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2021-08-30-09:47:22.txt
Log autoscript-2021-08-30-09:48:42.log.bz2
Memory 487 515 426

For details, please contact louberger

@NetDEF-CI
Copy link
Collaborator

NetDEF-CI commented Aug 30, 2021

Continuous Integration Result: SUCCESSFUL

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-21465/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Warnings Generated during build:

Checkout code: Successful with additional warnings
Report for interface.c | 6 issues
===============================================
< WARNING: externs should be avoided in .c files
< #65: FILE: /tmp/f1-21476/interface.c:65:
< WARNING: space prohibited between function name and open parenthesis '('
< #3773: FILE: /tmp/f1-21476/interface.c:3773:
< WARNING: line over 80 characters
< #4242: FILE: /tmp/f1-21476/interface.c:4242:

@NetDEF-CI
Copy link
Collaborator

NetDEF-CI commented Aug 30, 2021

Continuous Integration Result: SUCCESSFUL

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-21466/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Warnings Generated during build:

Checkout code: Successful with additional warnings
Report for interface.c | 6 issues
===============================================
< WARNING: externs should be avoided in .c files
< #65: FILE: /tmp/f1-31769/interface.c:65:
< WARNING: space prohibited between function name and open parenthesis '('
< #3775: FILE: /tmp/f1-31769/interface.c:3775:
< WARNING: line over 80 characters
< #4244: FILE: /tmp/f1-31769/interface.c:4244:

@@ -98,3 +98,35 @@ char *mpls_label2str(uint8_t num_labels, const mpls_label_t *labels, char *buf,

return buf;
}

int mpls_interface_set(const char *name, bool val)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally would prefer that we use the RTNLGRP_MPLS_NETCONF netlink messages to gather / set this data instead of manually setting via changing the proc file system.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you have something ready to pull, pls pick up this commit.
otherwise, I would prefer to push this, and in a second step, we link to RTNLGRP ?

Copy link
Contributor

@idryzhov idryzhov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs are missing

This configuration knob permits to set value of :
proc/sys/net/mpls/conf/<iface>/input.
Even if underlying interface is not available at the moment of the call.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
@pguibert6WIND
Copy link
Member Author

Docs are missing

I updated doc/../zebra.rst file.

@idryzhov idryzhov dismissed their stale review September 3, 2021 14:23

docs added

@LabN-CI
Copy link
Collaborator

LabN-CI commented Sep 3, 2021

💚 Basic BGPD CI results: SUCCESS, 0 tests failed

Results table
_ _
Result SUCCESS git merge/9505 cca9940
Date 09/03/2021
Start 11:35:19
Finish 12:01:27
Run-Time 26:08
Total 1813
Pass 1813
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2021-09-03-11:35:19.txt
Log autoscript-2021-09-03-11:36:28.log.bz2
Memory 513 463 426

For details, please contact louberger

@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-21583/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Warnings Generated during build:

Checkout code: Successful with additional warnings
Report for interface.c | 6 issues
===============================================
< WARNING: externs should be avoided in .c files
< #65: FILE: /tmp/f1-16508/interface.c:65:
< WARNING: space prohibited between function name and open parenthesis '('
< #3775: FILE: /tmp/f1-16508/interface.c:3775:
< WARNING: line over 80 characters
< #4244: FILE: /tmp/f1-16508/interface.c:4244:

@@ -168,6 +168,12 @@ Standard Commands
configuration.


.. clicmd:: mpls


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One blank line not 2

@qlyoung qlyoung dismissed their stale review September 14, 2021 15:30

blocking addressed

@qlyoung
Copy link
Member

qlyoung commented Sep 14, 2021

@frrbot rereview

@github-actions
Copy link

github-actions bot commented Jul 9, 2022

This PR is stale because it has been open 180 days with no activity. Comment or remove the autoclose label in order to avoid having this PR closed.

@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@pguibert6WIND
Copy link
Member Author

already merged by an other pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants