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

bgpd: handle fs nlri over 240 bytes #6242

Merged
merged 1 commit into from
Apr 22, 2020

Conversation

pguibert6WIND
Copy link
Member

the nlri flowspec above 240 bytes size was not handled.
Over 240 bytes, the length is 2 bytes length, and a calculation must be
done to obtain the real length. This commit handles it appropriately.

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

@polychaeta polychaeta added the bgp label Apr 16, 2020
@NetDEF-CI
Copy link
Collaborator

NetDEF-CI commented Apr 16, 2020

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-11909/

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:

Debian 10 amd64 build: Successful with additional warnings

Debian Package lintian failed for Debian 10 amd64 build:
(see full package build log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11909/artifact/DEB10BUILD/ErrorLog/log_lintian.txt)

W: frr source: pkg-js-tools-test-is-missing
W: frr source: newer-standards-version 4.4.1 (current is 4.3.0)
W: frr source: pkg-js-tools-test-is-missing
W: frr source: newer-standards-version 4.4.1 (current is 4.3.0)
W: frr-snmp: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200416-00-g6902e8cf1-0 (missing) -> 7.4-dev-20200416-00-g6902e8cf1-0~deb10u1
W: frr-doc: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200416-00-g6902e8cf1-0 (missing) -> 7.4-dev-20200416-00-g6902e8cf1-0~deb10u1
W: frr-pythontools: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200416-00-g6902e8cf1-0 (missing) -> 7.4-dev-20200416-00-g6902e8cf1-0~deb10u1
W: frr-rpki-rtrlib: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200416-00-g6902e8cf1-0 (missing) -> 7.4-dev-20200416-00-g6902e8cf1-0~deb10u1
W: frr: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200416-00-g6902e8cf1-0 (missing) -> 7.4-dev-20200416-00-g6902e8cf1-0~deb10u1

@LabN-CI
Copy link
Collaborator

LabN-CI commented Apr 16, 2020

Outdated results 🚧

Basic BGPD CI results: Partial FAILURE, 1 tests failed

_ _
Result SUCCESS git merge/6242 6902e8c
Date 04/16/2020
Start 11:53:50
Finish 12:19:49
Run-Time 25:59
Total 1818
Pass 1817
Fail 1
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2020-04-16-11:53:50.txt
Log autoscript-2020-04-16-11:54:48.log.bz2
Memory 485 500 429

For details, please contact louberger

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.

Ignore me, I can't read

@@ -108,13 +108,6 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr,
return BGP_NLRI_PARSE_ERROR_FLOWSPEC_IPV6_NOT_SUPPORTED;
}

if (packet->length >= FLOWSPEC_NLRI_SIZELIMIT) {
Copy link
Member

Choose a reason for hiding this comment

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

Don't we need to validate this? I.e., check should stay but should just be larger (4095 instead of 240)?

Copy link
Member Author

Choose a reason for hiding this comment

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

this should be done as part of regular bgp processing ( I think in bgp_io.c, length is checked)

Copy link
Member

Choose a reason for hiding this comment

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

It's not checked there. That code checks that the message size is within the BGP message limits. NLRI checks are different and done in bgp_packet.c IIRC. I am asking the question because I want to make sure we are not introducing a security issue by removing a bounds check here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I was talking about https://github.com/FRRouting/frr/blob/master/bgpd/bgp_io.c#L226
this said, there is a limit in rfc:
'
(0xfnnn). The highest value that can be represented with this
encoding is 4095. The value 241 is encoded as 0xf0f1.
'
so one can add a check instead.

@donaldsharp
Copy link
Member

@qlyoung are you happy with the code? If so I'll push it in( or you can )

the nlri flowspec above 240 bytes size was not handled.
Over 240 bytes, the length is 2 bytes length, and a calculation must be
done to obtain the real length. This commit handles it appropriately.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
@pguibert6WIND pguibert6WIND force-pushed the flowspec_nlri_too_big branch from 6902e8c to 3255e75 Compare April 22, 2020 10:12
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/f025b01c33d99757967cee50336f461c/raw/15a55bba11897936f5d64d55212e15a7d39e5a63/cr_6242_1587550355.diff | git apply

diff --git a/bgpd/bgp_flowspec_private.h b/bgpd/bgp_flowspec_private.h
index cec244c16..80f277108 100644
--- a/bgpd/bgp_flowspec_private.h
+++ b/bgpd/bgp_flowspec_private.h
@@ -20,7 +20,7 @@
 #define _FRR_BGP_FLOWSPEC_PRIVATE_H
 
 #define FLOWSPEC_NLRI_SIZELIMIT			240
-#define FLOWSPEC_NLRI_SIZELIMIT_EXTENDED		4095
+#define FLOWSPEC_NLRI_SIZELIMIT_EXTENDED 4095
 
 /* Flowspec raffic action bit*/
 #define FLOWSPEC_TRAFFIC_ACTION_TERMINAL	1

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

@LabN-CI
Copy link
Collaborator

LabN-CI commented Apr 22, 2020

💚 Basic BGPD CI results: SUCCESS, 0 tests failed

Results table
_ _
Result SUCCESS git merge/6242 3255e75
Date 04/22/2020
Start 06:20:27
Finish 06:46:21
Run-Time 25:54
Total 1815
Pass 1815
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2020-04-22-06:20:27.txt
Log autoscript-2020-04-22-06:21:27.log.bz2
Memory 464 497 425

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-11984/

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:

Debian 10 amd64 build: Successful with additional warnings

Debian Package lintian failed for Debian 10 amd64 build:
(see full package build log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-11984/artifact/DEB10BUILD/ErrorLog/log_lintian.txt)

W: frr source: pkg-js-tools-test-is-missing
W: frr source: newer-standards-version 4.4.1 (current is 4.3.0)
W: frr source: pkg-js-tools-test-is-missing
W: frr source: newer-standards-version 4.4.1 (current is 4.3.0)
W: frr-rpki-rtrlib: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200422-00-g3255e756a-0 (missing) -> 7.4-dev-20200422-00-g3255e756a-0~deb10u1
W: frr-snmp: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200422-00-g3255e756a-0 (missing) -> 7.4-dev-20200422-00-g3255e756a-0~deb10u1
W: frr: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200422-00-g3255e756a-0 (missing) -> 7.4-dev-20200422-00-g3255e756a-0~deb10u1
W: frr-pythontools: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200422-00-g3255e756a-0 (missing) -> 7.4-dev-20200422-00-g3255e756a-0~deb10u1
W: frr-doc: changelog-file-missing-explicit-entry 6.0-2 -> 7.4-dev-20200422-00-g3255e756a-0 (missing) -> 7.4-dev-20200422-00-g3255e756a-0~deb10u1

@qlyoung qlyoung merged commit 86ac1fa into FRRouting:master Apr 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants