summaryrefslogtreecommitdiff
path: root/netsniff-ng.c
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-07-03 17:41:04 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-07-03 17:41:04 +0200
commiteaa0a2777dc29e5f701efbc037b303b52f3e08be (patch)
tree7edaa21a58c0ae9aac7524c4b6210ffe97a73920 /netsniff-ng.c
parentc2dd1b3f2f459b90ed16600bcd5aa0369610e80e (diff)
pcap: invoke dev->type to pcap linktype mapper
Invoke dev->type to pcap linktype mapper in order to write a correct pcap file header for various link types. Also fix two bugs in pcap file header parsing and print a warning with the magic link number in case of an unknown link type. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Diffstat (limited to 'netsniff-ng.c')
-rw-r--r--netsniff-ng.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/netsniff-ng.c b/netsniff-ng.c
index 19d4db3..960ceaa 100644
--- a/netsniff-ng.c
+++ b/netsniff-ng.c
@@ -1102,7 +1102,6 @@ int main(int argc, char **argv)
bool prio_high = false, setsockmem = true;
void (*main_loop)(struct ctx *ctx) = NULL;
struct ctx ctx = {
- .link_type = LINKTYPE_EN10MB,
.print_mode = PRINT_NORM,
.cpu = -1,
.packet_type = -1,
@@ -1364,6 +1363,8 @@ int main(int argc, char **argv)
if (ctx.device_in && (device_mtu(ctx.device_in) ||
!strncmp("any", ctx.device_in, strlen(ctx.device_in)))) {
+ if (!ctx.rfraw)
+ ctx.link_type = pcap_devtype_to_linktype(ctx.device_in);
if (!ctx.device_out) {
ctx.dump = 0;
main_loop = recv_only_or_dump;