From b9c6d5c46ae57b32551e1383d8b33222e1f8a6a9 Mon Sep 17 00:00:00 2001 From: Michal Zima Date: Sat, 14 Jul 2012 09:47:29 +0200 Subject: [PATCH] Separated MTU and size of packet buffer --- src/wrapper.c | 6 ++---- src/wrapper.h | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/wrapper.c b/src/wrapper.c index bbdd7ae..fa1df34 100644 --- a/src/wrapper.c +++ b/src/wrapper.c @@ -43,8 +43,6 @@ #define IPV4_ADDR "192.168.0.111" /* --- CONFIGURATION --- */ -#define PACKET_SIZE MTU + sizeof(struct s_ethernet) - struct ifreq interface; struct s_mac_addr mac; @@ -63,7 +61,7 @@ int main(int argc, char **argv) int sniff_sock; int length; - char buffer[PACKET_SIZE]; + char buffer[PACKET_BUFFER]; log_info(PACKAGE_STRING " is starting"); @@ -128,7 +126,7 @@ int main(int argc, char **argv) /* sniff! :c) */ for (;;) { addr_size = sizeof(addr); - if ((length = recv(sniff_sock, buffer, PACKET_SIZE, 0)) == -1) { + if ((length = recv(sniff_sock, buffer, PACKET_BUFFER, 0)) == -1) { log_error("Unable to retrieve data from socket"); return 1; } diff --git a/src/wrapper.h b/src/wrapper.h index 1274b48..cd6c0cd 100644 --- a/src/wrapper.h +++ b/src/wrapper.h @@ -23,7 +23,8 @@ #include "ipv6.h" /* +++ CONFIGURE +++ */ -#define MTU 1280 +#define MTU 1280 /* MTU on IPv6 side */ +#define PACKET_BUFFER 1514 /* buffer for any packet */ /* --- CONFIGURE --- */ extern struct ifreq interface;