google / packetdrill

The official Google release of packetdrill
GNU General Public License v2.0
897 stars 221 forks source link

fix 'error: ‘SIOCGSTAMP’ undeclared' #27

Closed Jancd closed 4 years ago

Jancd commented 4 years ago
[sergey@chang packetdrill]$ ./configure 
[sergey@chang packetdrill]$ make
cc -g -Wall -Werror   -c -o packetdrill.o packetdrill.c
cc -g -Wall -Werror   -c -o checksum.o checksum.c
cc -g -Wall -Werror   -c -o code.o code.c
cc -g -Wall -Werror   -c -o config.o config.c
cc -g -Wall -Werror   -c -o hash.o hash.c
cc -g -Wall -Werror   -c -o hash_map.o hash_map.c
cc -g -Wall -Werror   -c -o ip_address.o ip_address.c
cc -g -Wall -Werror   -c -o ip_prefix.o ip_prefix.c
cc -g -Wall -Werror   -c -o netdev.o netdev.c
cc -g -Wall -Werror   -c -o net_utils.o net_utils.c
cc -g -Wall -Werror   -c -o packet.o packet.c
cc -g -Wall -Werror   -c -o packet_socket_linux.o packet_socket_linux.c
packet_socket_linux.c: In function ‘packet_socket_setup’:
packet_socket_linux.c:100:26: error: ‘SIOCGSTAMP’ undeclared (first use in this function)
  ioctl(psock->packet_fd, SIOCGSTAMP, &tv);
                          ^
packet_socket_linux.c:100:26: note: each undeclared identifier is reported only once for each function it appears in
packet_socket_linux.c: In function ‘packet_socket_receive’:
packet_socket_linux.c:270:30: error: ‘SIOCGSTAMP’ undeclared (first use in this function)
  if (ioctl(psock->packet_fd, SIOCGSTAMP, &tv) < 0)
                              ^
make: *** [packet_socket_linux.o] Error 1

Signed-off-by: Sergey Chang sergeychang@gmail.com

nealcardwell commented 4 years ago

Thanks for this patch! A couple thoughts:

(1) Please follow the instructions here, in particular about the contents and format of the commit description: https://github.com/google/packetdrill#how-to-submit-a-patch-for-packetdrill

(2) Can you please document in the commit description the distribution and version number where you encountered this problem, and also document where you have tested the fix? (e.g. encountered on Debian x.y, and tested on Debian x.y and Ubuntu a.b, Fedora c.d, etc).

Thanks!

nealcardwell commented 4 years ago

For the record, I can confirm that this compiles for me on:

DISTRIB_ID=Ubuntu DISTRIB_RELEASE=18.04 DISTRIB_CODENAME=bionic DISTRIB_DESCRIPTION="Ubuntu 18.04.3 LTS"

$ gcc --version gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 Copyright (C) 2017 Free Software Foundation, Inc.

Thanks!

nealcardwell commented 4 years ago

Merged as:

https://github.com/google/packetdrill/commit/296fb3f046d5528b90d8b3a73e99075b1113a355