On Tue, Jul 17, 2012 at 10:35:39AM +0200, Nikola Pajkovsky wrote:
Signed-off-by: Nikola Pajkovsky <npajkovs(a)redhat.com>
---
src/detstats.c | 6 ++---
src/itrafmon.c | 70 +++++++++++++++++++++++++-------------------------------
src/packet.c | 52 +++++++++++++++++++++++++++++++++++------
src/packet.h | 25 +++++++++++---------
src/serv.c | 13 +++++------
5 files changed, 98 insertions(+), 68 deletions(-)
[...]
diff --git a/src/packet.c b/src/packet.c
index fbd94f1..2da6686 100644
--- a/src/packet.c
+++ b/src/packet.c
@@ -20,6 +20,23 @@ packet.c - routines to open the raw socket, read socket data and
#include "packet.h"
#include "ipfrag.h"
+#define pkt_cast_hdrp_l2off_t(hdr, pkt, off) \
+ do { \
+ pkt->hdr = (struct hdr *) pkt->pkt_buf + off; \
This must be like this:
pkt->hdr = (struct hdr *) (pkt->pkt_buf + off);
+ } while (0)
+
+#define pkt_cast_hdrp_l2(hdr, pkt) \
+ pkt_cast_hdrp_l2off_t(hdr, pkt, 0)
+
+
+#define pkt_cast_hdrp_l3off_t(hdr, pkt, off) \
+ do { \
+ pkt->hdr = (struct hdr *) pkt->pkt_payload + off; \
This must be like this:
pkt->hdr = (struct hdr *) (pkt->pkt_payload + off);
+ } while (0)
+
+#define pkt_cast_hdrp_l3(hdr, pkt) \
+ pkt_cast_hdrp_l3off_t(hdr, pkt, 0)
+
/* code taken from
http://www.faqs.org/rfcs/rfc1071.html. See section 4.1 "C"
*/
static int in_cksum(u_short * addr, int len)
{
Vita