Re: [tcpdump-workers] Adding support for ETSI GeoNetworking networkand BTP transport protocol

2013-07-03 Thread Gisle Vanem

"Denis Ovsienko"  wrote:


is anybody else willing to review this pull request?

https://github.com/the-tcpdump-group/tcpdump/pull/324


I just did a build with MSVC after a new checkout of
 https://github.com/the-tcpdump-group/tcpdump.git 


It didn't work out-of-the box because my MSVC (v16 from Visual C
Express 2010) isn't a C99 compiler; you cannot have code ahead of 
declarations.  Hence these patches should be applied:


--- Git-Latest/print-calm-fast.c2013-07-03 09:24:42 +
+++ ./print-calm-fast.c 2013-07-03 09:53:37 +
@@ -42,13 +42,12 @@
void
calm_fast_print(netdissect_options *ndo, const u_char *eth, const u_char *bp, 
u_int length)
{
-   printf("CALM FAST src:%s; ", etheraddr_string(eth+6));
-
   int srcNwref = bp[0];
   int dstNwref = bp[1];
   length -= 2;
   bp += 2;

+   printf("CALM FAST src:%s; ", etheraddr_string(eth+6));
   printf("SrcNwref:%d; ", srcNwref);
   printf("DstNwref:%d; ", dstNwref);

--- Git-Latest/print-geonet.c   2013-07-03 09:24:42 +
+++ ./print-geonet.c2013-07-03 09:54:27 +
@@ -58,14 +58,18 @@
static void
print_btp_body(const u_char *bp, u_int length)
{
+   int version;
+   int msg_type;
+   const char *msg_type_str;
+
   if (length <= 2) {
   return;
   }

   // Assuming ItsDpuHeader
-   int version = bp[0];
-   int msg_type = bp[1];
-   const char *msg_type_str = tok2str(msg_type_values, "unknown (%u)", 
msg_type);
+   version = bp[0];
+   msg_type = bp[1];
+   msg_type_str = tok2str(msg_type_values, "unknown (%u)", msg_type);

   printf("; ItsPduHeader v:%d t:%d-%s", version, msg_type, msg_type_str);
}



And  must go on Windows:

--- Git-Latest/print-carp.c 2013-07-03 09:24:42 +
+++ ./print-carp.c  2011-12-22 19:56:22 +
@@ -44,7 +44,9 @@
#include 
#include 

+#ifndef WIN32
#include 
+#endif

#include "interface.h"
#include "extract.h"

--gv
___
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers


[tcpdump-workers] [PATCH libpcap] linktype: add netlink link/dlt type

2013-07-03 Thread Daniel Borkmann
For pcap interoperability, introduce a common link type for netlink
captures. Netlink debugging workflow looks like the following:

Setup:
  modprobe nlmon
  ip link add type nlmon
  ip link set nlmon0 up

Capture:
  tcpdump -i nlmon0 ...

Teardown:
  ip link set nlmon0 down
  ip link del dev nlmon0
  rmmod nlmon

Signed-off-by: Daniel Borkmann 
CC: Thomas Graf 
CC: Tobias Klauser 
---
 pcap-common.c | 7 ++-
 pcap/bpf.h| 7 ++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/pcap-common.c b/pcap-common.c
index 6175a5a..f26d22e 100644
--- a/pcap-common.c
+++ b/pcap-common.c
@@ -932,7 +932,12 @@
  */
 #define LINKTYPE_WIRESHARK_UPPER_PDU   252
 
-#define LINKTYPE_MATCHING_MAX  252 /* highest value in the 
"matching" range */
+/*
+ * Link-layer header type for the netlink protocol (nlmon devices).
+ */
+#define LINKTYPE_NETLINK   253
+
+#define LINKTYPE_MATCHING_MAX  253 /* highest value in the 
"matching" range */
 
 static struct linktype_map {
int dlt;
diff --git a/pcap/bpf.h b/pcap/bpf.h
index ad36eb6..8286ed5 100644
--- a/pcap/bpf.h
+++ b/pcap/bpf.h
@@ -1224,7 +1224,12 @@ struct bpf_program {
  */
 #define DLT_WIRESHARK_UPPER_PDU252
 
-#define DLT_MATCHING_MAX   252 /* highest value in the "matching" 
range */
+/*
+ * DLT type for the netlink protocol (nlmon devices).
+ */
+#define DLT_NETLINK253
+
+#define DLT_MATCHING_MAX   253 /* highest value in the "matching" 
range */
 
 /*
  * DLT and savefile link type values are split into a class and
-- 
1.7.11.7

___
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers


Re: [tcpdump-workers] Adding support for ETSI GeoNetworking networkand BTP transport protocol

2013-07-03 Thread Denis Ovsienko
03.07.2013, 14:18, "Gisle Vanem" :
> "Denis Ovsienko"  wrote:
>
>>  is anybody else willing to review this pull request?
>>
>>  https://github.com/the-tcpdump-group/tcpdump/pull/324
>
> I just did a build with MSVC after a new checkout of
>   https://github.com/the-tcpdump-group/tcpdump.git
>
> It didn't work out-of-the box because my MSVC (v16 from Visual C
> Express 2010) isn't a C99 compiler; you cannot have code ahead of
> declarations.  Hence these patches should be applied:
>
[...]

Thank you for the feedback!

> 
>
> And  must go on Windows:

I addressed this in a little cleaner way. The changes are in the master branch 
now, could you check?

-- 
Denis Ovsienko
___
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers


Re: [tcpdump-workers] Adding support for ETSI GeoNetworking networkand BTP transport protocol

2013-07-03 Thread Gisle Vanem

"Denis Ovsienko"  wrote:


And  must go on Windows:


I addressed this in a little cleaner way. The changes are in the master branch 
now, could you check?


Works fine with MSVC. I've added a comment on print-carp.c:
 
https://github.com/the-tcpdump-group/tcpdump/commit/9a68bf303ada7a69d853eeefa09634a5a077e48e#commitcomment-3560517

--gv
___
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers