<div dir="auto">What other packet types would a DPDK app use. The possible type fields are quite limited see the spec.<div dir="auto"><br></div><div dir="auto">Plus it would be an ABI breakage would require versioning.</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Thu, May 29, 2025, 10:16 Schneide <<a href="mailto:schneide@qti.qualcomm.com">schneide@qti.qualcomm.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Dylan Schneider <<a href="mailto:schneide@qti.qualcomm.com" target="_blank" rel="noreferrer">schneide@qti.qualcomm.com</a>><br>
<br>
Allow the user to specify protocol link type when creating pcapng files.<br>
This change is needed to specify the protocol type in the pcapng file,<br>
DLT_EN10MB specifies ethernet packets only. This will allow dissectors<br>
for other protocols to be used on files generated by pcapng.<br>
<br>
Includes a breaking change to rte_pcapng_add_interface to add link_type<br>
parameter. Existing calls to the function have been updated to pass<br>
DLT_EN10MB for the link type argument.<br>
<br>
Fixes: d1da6d0d04c7 ("pcapng: require per-interface information")<br>
Signed-off-by: Dylan Schneider <<a href="mailto:schneide@qti.qualcomm.com" target="_blank" rel="noreferrer">schneide@qti.qualcomm.com</a>><br>
Cc: <a href="mailto:stephen@networkplumber.org" target="_blank" rel="noreferrer">stephen@networkplumber.org</a><br>
---<br>
<br>
diff --git a/.mailmap b/.mailmap<br>
index d9423aa..7ef0964 100644<br>
--- a/.mailmap<br>
+++ b/.mailmap<br>
@@ -388,6 +388,7 @@<br>
 Dumitru Ceara <<a href="mailto:dceara@redhat.com" target="_blank" rel="noreferrer">dceara@redhat.com</a>> <<a href="mailto:dumitru.ceara@gmail.com" target="_blank" rel="noreferrer">dumitru.ceara@gmail.com</a>><br>
 Duncan Bellamy <<a href="mailto:dunk@denkimushi.com" target="_blank" rel="noreferrer">dunk@denkimushi.com</a>><br>
 Dustin Lundquist <<a href="mailto:dustin@null-ptr.net" target="_blank" rel="noreferrer">dustin@null-ptr.net</a>><br>
+Dylan Schneider <<a href="mailto:schneide@qti.qualcomm.com" target="_blank" rel="noreferrer">schneide@qti.qualcomm.com</a>><br>
 Dzmitry Sautsa <<a href="mailto:dzmitryx.sautsa@intel.com" target="_blank" rel="noreferrer">dzmitryx.sautsa@intel.com</a>><br>
 Ed Czeck <<a href="mailto:ed.czeck@atomicrules.com" target="_blank" rel="noreferrer">ed.czeck@atomicrules.com</a>><br>
 Eduard Serra <<a href="mailto:eserra@vmware.com" target="_blank" rel="noreferrer">eserra@vmware.com</a>><br>
diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c<br>
index 3d3c0db..e0e2b26 100644<br>
--- a/app/dumpcap/main.c<br>
+++ b/app/dumpcap/main.c<br>
@@ -800,8 +800,8 @@ static dumpcap_out_t create_output(void)<br>
                free(os);<br>
<br>
                TAILQ_FOREACH(intf, &interfaces, next) {<br>
-                       if (rte_pcapng_add_interface(ret.pcapng, intf->port, intf->ifname,<br>
-                                                    intf->ifdescr, intf->opts.filter) < 0)<br>
+                       if (rte_pcapng_add_interface(ret.pcapng, intf->port, DLT_EN10MB,<br>
+                               intf->ifname, intf->ifdescr, intf->opts.filter) < 0)<br>
                                rte_exit(EXIT_FAILURE, "rte_pcapng_add_interface %u failed\n",<br>
                                        intf->port);<br>
                }<br>
diff --git a/app/test/test_pcapng.c b/app/test/test_pcapng.c<br>
index 8f2cff3..bcf9972 100644<br>
--- a/app/test/test_pcapng.c<br>
+++ b/app/test/test_pcapng.c<br>
@@ -345,7 +345,7 @@ test_add_interface(void)<br>
        }<br>
<br>
        /* Add interface to the file */<br>
-       ret = rte_pcapng_add_interface(pcapng, port_id,<br>
+       ret = rte_pcapng_add_interface(pcapng, port_id, DLT_EN10MB,<br>
                                       NULL, NULL, NULL);<br>
        if (ret < 0) {<br>
                fprintf(stderr, "can not add port %u\n", port_id);<br>
@@ -353,7 +353,7 @@ test_add_interface(void)<br>
        }<br>
<br>
        /* Add interface with ifname and ifdescr */<br>
-       ret = rte_pcapng_add_interface(pcapng, port_id,<br>
+       ret = rte_pcapng_add_interface(pcapng, port_id, DLT_EN10MB,<br>
                                       "myeth", "Some long description", NULL);<br>
        if (ret < 0) {<br>
                fprintf(stderr, "can not add port %u with ifname\n", port_id);<br>
@@ -361,7 +361,7 @@ test_add_interface(void)<br>
        }<br>
<br>
        /* Add interface with filter */<br>
-       ret = rte_pcapng_add_interface(pcapng, port_id,<br>
+       ret = rte_pcapng_add_interface(pcapng, port_id, DLT_EN10MB,<br>
                                       NULL, NULL, "tcp port 8080");<br>
        if (ret < 0) {<br>
                fprintf(stderr, "can not add port %u with filter\n", port_id);<br>
@@ -406,7 +406,7 @@ test_write_packets(void)<br>
        }<br>
<br>
        /* Add interface to the file */<br>
-       ret = rte_pcapng_add_interface(pcapng, port_id,<br>
+       ret = rte_pcapng_add_interface(pcapng, port_id, DLT_EN10MB,<br>
                                       NULL, NULL, NULL);<br>
        if (ret < 0) {<br>
                fprintf(stderr, "can not add port %u\n", port_id);<br>
diff --git a/lib/graph/graph_pcap.c b/lib/graph/graph_pcap.c<br>
index 89525f1..46fab8c 100644<br>
--- a/lib/graph/graph_pcap.c<br>
+++ b/lib/graph/graph_pcap.c<br>
@@ -117,7 +117,7 @@ graph_pcap_file_open(const char *filename)<br>
<br>
        /* Add the configured interfaces as possible capture ports */<br>
        RTE_ETH_FOREACH_DEV(portid) {<br>
-               ret = rte_pcapng_add_interface(pcapng_fd, portid,<br>
+               ret = rte_pcapng_add_interface(pcapng_fd, portid, DLT_EN10MB<br>
                                               NULL, NULL, NULL);<br>
                if (ret < 0) {<br>
                        graph_err("Graph rte_pcapng_add_interface port %u failed: %d",<br>
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c<br>
index 16485b2..bed1e14 100644<br>
--- a/lib/pcapng/rte_pcapng.c<br>
+++ b/lib/pcapng/rte_pcapng.c<br>
@@ -205,7 +205,7 @@ pcapng_section_block(rte_pcapng_t *self,<br>
 /* Write an interface block for a DPDK port */<br>
 RTE_EXPORT_SYMBOL(rte_pcapng_add_interface)<br>
 int<br>
-rte_pcapng_add_interface(rte_pcapng_t *self, uint16_t port,<br>
+rte_pcapng_add_interface(rte_pcapng_t *self, uint16_t port, uint16_t link_type,<br>
                         const char *ifname, const char *ifdescr,<br>
                         const char *filter)<br>
 {<br>
@@ -277,7 +277,7 @@ rte_pcapng_add_interface(rte_pcapng_t *self, uint16_t port,<br>
        hdr = (struct pcapng_interface_block *)buf;<br>
        *hdr = (struct pcapng_interface_block) {<br>
                .block_type = PCAPNG_INTERFACE_BLOCK,<br>
-               .link_type = 1,         /* DLT_EN10MB - Ethernet */<br>
+               .link_type = link_type,<br>
                .block_length = len,<br>
        };<br>
<br>
diff --git a/lib/pcapng/rte_pcapng.h b/lib/pcapng/rte_pcapng.h<br>
index 48f2b57..0a35ec9 100644<br>
--- a/lib/pcapng/rte_pcapng.h<br>
+++ b/lib/pcapng/rte_pcapng.h<br>
@@ -71,6 +71,8 @@ rte_pcapng_close(rte_pcapng_t *self);<br>
  *  The handle to the packet capture file<br>
  * @param port<br>
  *  The Ethernet port to report stats on.<br>
+ * @param link_type<br>
+ *  The protocol link type of the packets<br>
  * @param ifname (optional)<br>
  *  Interface name to record in the file.<br>
  *  If not specified, name will be constructed from port<br>
@@ -84,7 +86,7 @@ rte_pcapng_close(rte_pcapng_t *self);<br>
  * must be added.<br>
  */<br>
 int<br>
-rte_pcapng_add_interface(rte_pcapng_t *self, uint16_t port,<br>
+rte_pcapng_add_interface(rte_pcapng_t *self, uint16_t port, uint16_t link_type,<br>
                         const char *ifname, const char *ifdescr,<br>
                         const char *filter);<br>
<br>
</blockquote></div>