Change in libosmocore[master]: gprs_ns2_fr: use ETH_P_HDLC instead of ETH_P_ALL

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
Thu Dec 10 21:13:49 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/21667 )

Change subject: gprs_ns2_fr: use ETH_P_HDLC instead of ETH_P_ALL
......................................................................

gprs_ns2_fr: use ETH_P_HDLC instead of ETH_P_ALL

When opening the socket, use ETH_P_HLDC to restrict the socket to
packet received on HLDC interfaces.  This avoids packets from random
other (ethernet, ...) interfaces to appear before we can bind()
it to the actual hdlc-net-device we're interested in.

We still are racing against other HLDC net-devices, but those have
lower PPS and throughput ratese as 1G/10G or even higher speed ethernet
devices that might exist on the same machine.

Change-Id: I6a556e6e2d012c17a2777cc8b30fed0f318db178
---
M src/gb/gprs_ns2_fr.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index 0e4e2d3..2d5b021 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -317,7 +317,7 @@
 	addr.sll_protocol = htons(ETH_P_ALL);
 	addr.sll_ifindex = ifindex;
 
-	fd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
+	fd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_HDLC));
 	if (fd < 0) {
 		LOGP(DLNS, LOGL_ERROR, "Can not create AF_PACKET socket. Are you root or have CAP_RAW_SOCKET?\n");
 		return fd;

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I6a556e6e2d012c17a2777cc8b30fed0f318db178
Gerrit-Change-Number: 21667
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201210/21b0af00/attachment.htm>


More information about the gerrit-log mailing list