After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 777641 - pcapparse: add support of parsing by mac addresses and ethertype for raw ethernet frames.
pcapparse: add support of parsing by mac addresses and ethertype for raw ethe...
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-01-23 08:47 UTC by Konstantin Ripak
Modified: 2018-11-03 14:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (15.19 KB, patch)
2017-01-23 08:47 UTC, Konstantin Ripak
needs-work Details | Review

Description Konstantin Ripak 2017-01-23 08:47:00 UTC
Created attachment 344021 [details] [review]
patch

Add support for parsing pcap files for some specific protocol types.
This is required, for example, to parse and replay IEEE1722 streams.
Comment 1 Konstantin Ripak 2017-03-16 09:11:02 UTC
Hi, what is the status of reviewing this patch?
Thanks, Konstantin.
Comment 2 Petr Nechaev 2017-05-12 12:23:26 UTC
Review of attachment 344021 [details] [review]:

These lines need to be removed: unnecessary style changes

-static gboolean gst_pcap_sink_event (GstPad * pad,
-    GstObject * parent, GstEvent * event);
+static gboolean gst_pcap_sink_event (GstPad * pad, GstObject * parent,
+    GstEvent * event);
 

guint should not be set to "-1": unnecessary code complexity
+  self->ethertype = -1;
Use larger int type if you need negative values.
Comment 4 Sebastian Dröge (slomo) 2017-08-09 07:03:14 UTC
Review of attachment 344021 [details] [review]:

::: gst/pcapparse/gstpcapparse.c
@@ +48,3 @@
 #include <string.h>
+#include <glib-2.0/gobject/gparamspecs.h>
+#include <glib-2.0/gobject/gvaluetypes.h>

Including these is not necessary

@@ +55,3 @@
 #include <netinet/in.h>
 #include <string.h>
+#include <gstreamer-1.0/gst/gstinfo.h>

and this neither.

@@ +145,3 @@
       g_param_spec_boxed ("caps", "Caps",
+          "The caps of the source pad",
+          GST_TYPE_CAPS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

Please don't change the indentation of unrelated code

@@ +378,3 @@
+    {
+      const gchar *src_mac_str = g_value_get_string (value);
+      if (parse_mac_to_uint (src_mac_str, self->src_mac) < 0) {

src_mac_str might be NULL but your parsing function does not handle that

@@ +467,3 @@
+        vlan = 1;
+        eth_type = GUINT16_FROM_BE (*((guint16 *) (buf + 16)));
+        if (eth_type == 0x8100) // VLAN

VLAN support was added in https://bugzilla.gnome.org/show_bug.cgi?id=785778 already, independent of this

@@ +483,3 @@
+            || (self->src_mac[3] != (*((guint8 *) (buf + 9))))
+            || (self->src_mac[4] != (*((guint8 *) (buf + 10))))
+            || (self->src_mac[5] != (*((guint8 *) (buf + 11)))))

You could use memcmp() here

@@ +554,3 @@
+      *payload_size = len - UDP_HEADER_LEN;
+    } else {
+      if (buf_proto + 12 >= buf + buf_size)

For everything but 0x800, we don't parse anything out and just pass onwards any e.g. IP and UDP header? That seems suboptimal :) How would this be used?

@@ +733,3 @@
+        segment.start = self->offset;
+      } else {
+        segment.start = self->base_ts;

Why?
Comment 5 GStreamer system administrator 2018-11-03 14:03:58 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/511.