Avnu / OpenAvnu

OpenAvnu - an Avnu sponsored repository for Time Sensitive Network (TSN and AVB) technology
462 stars 289 forks source link

avtp_pipeline/pcap build fixes #896

Open lhoward opened 4 years ago

lhoward commented 4 years ago

If this code is being actively maintained I'm happy to submit pull requests. :) A couple of things I noticed whilst kicking tyres, waiting for i210 card to arrive.

In pcap_rawsock.c, this cleans up a bunch of verbose logging about receiving non-AVTP packets:

diff --git a/lib/avtp_pipeline/platform/Linux/rawsock/pcap_rawsock.c b/lib/avtp_pipeline/platform/Linux/rawsock/pcap_rawsock.c
index de0d7967..803dd509 100644
--- a/lib/avtp_pipeline/platform/Linux/rawsock/pcap_rawsock.c
+++ b/lib/avtp_pipeline/platform/Linux/rawsock/pcap_rawsock.c
@@ -229,9 +229,10 @@ bool pcapRawsockRxMulticast(void *pvRawsock, bool add_membership, const U8 addr[
        pcap_rawsock_t *rawsock = (pcap_rawsock_t*)pvRawsock;

        struct bpf_program comp_filter_exp;
-       char filter_exp[30];
+       char filter_exp[64];

-       sprintf(filter_exp, "ether dst %02x:%02x:%02x:%02x:%02x:%02x", addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
+       snprintf(filter_exp, sizeof(filter_exp), "ether proto %u and ether dst %02x:%02x:%02x:%02x:%02x:%02x",
+                rawsock->base.ethertype, addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);

        AVB_LOGF_DEBUG("%s %d %s", __func__, (int)add_membership, filter_exp);

Also, in openavb_qmgr.c, there are some assumptions that if AVB_FEATURE_IGB is undefined, AVB_FEATURE_ATL must be. They should be separate checks/#elif.