Skip to content
Snippets Groups Projects
Commit fbce0d3b authored by Michael Tüxen's avatar Michael Tüxen
Browse files
parent b47ff34a
No related branches found
No related tags found
No related merge requests found
packetdrill-ext-libs := -lpcap packetdrill-ext-libs := -lpcap
CFLAGS = -D__APPLE_USE_RFC_3542 -Wall -Werror -Wno-unknown-warning-option -Wno-address-of-packed-member CFLAGS = -D__APPLE_USE_RFC_3542 -Wall -Werror -Wno-unknown-warning-option
LDFLAGS = LDFLAGS =
ifneq ("$(wildcard /usr/lib/libsctp.dylib)","") ifneq ("$(wildcard /usr/lib/libsctp.dylib)","")
packetdrill-ext-libs += -lsctp packetdrill-ext-libs += -lsctp
......
...@@ -2,6 +2,6 @@ ARCH != uname -p ...@@ -2,6 +2,6 @@ ARCH != uname -p
packetdrill-ext-libs := -lprocstat -lutil -lkvm -lelf -lpthread -lpcap packetdrill-ext-libs := -lprocstat -lutil -lkvm -lelf -lpthread -lpcap
CFLAGS = -Wall -Werror CFLAGS = -Wall -Werror
.if ${ARCH} != "powerpc" && ${ARCH} != "powerpc64" .if ${ARCH} != "powerpc" && ${ARCH} != "powerpc64"
CFLAGS += -Wno-unknown-warning-option -Wno-address-of-packed-member CFLAGS += -Wno-unknown-warning-option
.endif .endif
.include "Makefile.common" .include "Makefile.common"
packetdrill-ext-libs := -lpthread -lrt -ldl -lsctp -static packetdrill-ext-libs := -lpthread -lrt -ldl -lsctp -static
CFLAGS = -Wall -Werror -Wno-unknown-warning-option -Wno-address-of-packed-member CFLAGS = -Wall -Werror -Wno-unknown-warning-option
include Makefile.common include Makefile.common
packetdrill-ext-libs := -lpthread -lpcap packetdrill-ext-libs := -lpthread -lpcap
CFLAGS = -Wall -Werror -Wno-unknown-warning-option -Wno-address-of-packed-member CFLAGS = -Wall -Werror -Wno-unknown-warning-option
.include "Makefile.common" .include "Makefile.common"
packetdrill-ext-libs := -lpthread -lpcap packetdrill-ext-libs := -lpthread -lpcap
CFLAGS = -Wall -Werror -Wno-unknown-warning-option -Wno-address-of-packed-member CFLAGS = -Wall -Werror -Wno-unknown-warning-option
.include "Makefile.common" .include "Makefile.common"
...@@ -26,9 +26,11 @@ ...@@ -26,9 +26,11 @@
#ifndef __PACKET_H__ #ifndef __PACKET_H__
#define __PACKET_H__ #define __PACKET_H__
#include <stddef.h>
#include <sys/time.h>
#include "types.h" #include "types.h"
#include <sys/time.h>
#include "assert.h" #include "assert.h"
#include "gre.h" #include "gre.h"
#include "header.h" #include "header.h"
...@@ -422,7 +424,7 @@ static inline u32 *packet_echoed_sctp_v_tag(struct packet *packet, bool encapsul ...@@ -422,7 +424,7 @@ static inline u32 *packet_echoed_sctp_v_tag(struct packet *packet, bool encapsul
{ {
struct sctp_common_header *echoed_sctp = packet_echoed_sctp_header(packet, encapsulated); struct sctp_common_header *echoed_sctp = packet_echoed_sctp_header(packet, encapsulated);
assert(echoed_sctp); assert(echoed_sctp);
u32 *v_tag = &(echoed_sctp->v_tag); u32 *v_tag = (u32 *)((char *)echoed_sctp + offsetof(struct sctp_common_header, v_tag));
/* Check that the v_tag field is actually in the space we /* Check that the v_tag field is actually in the space we
* reserved for the echoed prefix of the SCTP common header. * reserved for the echoed prefix of the SCTP common header.
*/ */
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/socket.h> #include <sys/socket.h>
...@@ -553,8 +554,12 @@ static int find_tcp_timestamp(struct packet *packet, char **error) ...@@ -553,8 +554,12 @@ static int find_tcp_timestamp(struct packet *packet, char **error)
for (option = tcp_options_begin(packet, &iter); option != NULL; for (option = tcp_options_begin(packet, &iter); option != NULL;
option = tcp_options_next(&iter, error)) option = tcp_options_next(&iter, error))
if (option->kind == TCPOPT_TIMESTAMP) { if (option->kind == TCPOPT_TIMESTAMP) {
packet->tcp_ts_val = &(option->data.time_stamp.val); const size_t val_off = offsetof(struct tcp_option,
packet->tcp_ts_ecr = &(option->data.time_stamp.ecr); data.time_stamp.val);
const size_t ecr_off = offsetof(struct tcp_option,
data.time_stamp.ecr);
packet->tcp_ts_val = (__be32 *)((char *)option + val_off);
packet->tcp_ts_ecr = (__be32 *)((char *)option + ecr_off);
} }
return *error ? STATUS_ERR : STATUS_OK; return *error ? STATUS_ERR : STATUS_OK;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment