diff options
Diffstat (limited to 'package/libs/libpcap/patches/202-protocol_api.patch')
-rw-r--r-- | package/libs/libpcap/patches/202-protocol_api.patch | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/package/libs/libpcap/patches/202-protocol_api.patch b/package/libs/libpcap/patches/202-protocol_api.patch index 892aeb7e0d..fabbac73f1 100644 --- a/package/libs/libpcap/patches/202-protocol_api.patch +++ b/package/libs/libpcap/patches/202-protocol_api.patch @@ -4,13 +4,13 @@ char *source; int promisc; int rfmon; -+ int proto; /* protocol for packet socket (linux) */ ++ int proto; /* protocol for packet socket (linux) */ + int tstamp_type; }; - /* --- a/pcap-linux.c +++ b/pcap-linux.c -@@ -335,7 +335,7 @@ static int iface_get_id(int fd, const ch +@@ -363,7 +363,7 @@ static int iface_get_id(int fd, const ch static int iface_get_mtu(int fd, const char *device, char *ebuf); static int iface_get_arptype(int fd, const char *device, char *ebuf); #ifdef HAVE_PF_PACKET_SOCKETS @@ -19,7 +19,7 @@ #ifdef IW_MODE_MONITOR static int has_wext(int sock_fd, const char *device, char *ebuf); #endif /* IW_MODE_MONITOR */ -@@ -881,7 +881,7 @@ pcap_can_set_rfmon_linux(pcap_t *handle) +@@ -980,7 +980,7 @@ pcap_can_set_rfmon_linux(pcap_t *handle) * (We assume that if we have Wireless Extensions support * we also have PF_PACKET support.) */ @@ -28,7 +28,7 @@ if (sock_fd == -1) { (void)snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "socket: %s", pcap_strerror(errno)); -@@ -1128,6 +1128,9 @@ pcap_activate_linux(pcap_t *handle) +@@ -1266,6 +1266,9 @@ pcap_activate_linux(pcap_t *handle) handle->read_op = pcap_read_linux; handle->stats_op = pcap_stats_linux; @@ -38,7 +38,7 @@ /* * The "any" device is a special device which causes us not * to bind to a particular device and thus to look at all -@@ -2684,8 +2687,8 @@ activate_new(pcap_t *handle) +@@ -2897,8 +2900,8 @@ activate_new(pcap_t *handle) * try a SOCK_RAW socket for the raw interface. */ sock_fd = is_any_device ? @@ -48,8 +48,8 @@ + socket(PF_PACKET, SOCK_RAW, handle->opt.proto); if (sock_fd == -1) { - snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "socket: %s", -@@ -2783,7 +2786,7 @@ activate_new(pcap_t *handle) + if (errno == EINVAL || errno == EAFNOSUPPORT) { +@@ -3015,7 +3018,7 @@ activate_new(pcap_t *handle) return PCAP_ERROR; } sock_fd = socket(PF_PACKET, SOCK_DGRAM, @@ -58,7 +58,7 @@ if (sock_fd == -1) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "socket: %s", pcap_strerror(errno)); -@@ -2835,7 +2838,7 @@ activate_new(pcap_t *handle) +@@ -3078,7 +3081,7 @@ activate_new(pcap_t *handle) } if ((err = iface_bind(sock_fd, handle->md.ifindex, @@ -67,7 +67,7 @@ close(sock_fd); if (err < 0) return err; -@@ -3640,7 +3643,7 @@ iface_get_id(int fd, const char *device, +@@ -4149,7 +4152,7 @@ iface_get_id(int fd, const char *device, * or a PCAP_ERROR_ value on a hard error. */ static int @@ -76,7 +76,7 @@ { struct sockaddr_ll sll; int err; -@@ -3649,7 +3652,7 @@ iface_bind(int fd, int ifindex, char *eb +@@ -4158,7 +4161,7 @@ iface_bind(int fd, int ifindex, char *eb memset(&sll, 0, sizeof(sll)); sll.sll_family = AF_PACKET; sll.sll_ifindex = ifindex; @@ -85,7 +85,7 @@ if (bind(fd, (struct sockaddr *) &sll, sizeof(sll)) == -1) { if (errno == ENETDOWN) { -@@ -4359,7 +4362,7 @@ activate_old(pcap_t *handle) +@@ -5040,7 +5043,7 @@ activate_old(pcap_t *handle) /* Open the socket */ @@ -96,20 +96,18 @@ "socket: %s", pcap_strerror(errno)); --- a/pcap.c +++ b/pcap.c -@@ -258,6 +258,8 @@ pcap_create_common(const char *source, c +@@ -309,6 +309,7 @@ pcap_create_common(const char *source, c pcap_set_snaplen(p, 65535); /* max packet size */ p->opt.promisc = 0; p->opt.buffer_size = 0; + p->opt.proto = -1; -+ + p->opt.tstamp_type = -1; /* default to not setting time stamp type */ return (p); } - -@@ -317,6 +319,15 @@ pcap_set_buffer_size(pcap_t *p, int buff - return 0; +@@ -405,6 +406,15 @@ pcap_set_buffer_size(pcap_t *p, int buff } -+int + int +pcap_set_protocol(pcap_t *p, unsigned short proto) +{ + if (pcap_check_activated(p)) @@ -118,9 +116,10 @@ + return 0; +} + - int ++int pcap_activate(pcap_t *p) { + int status; --- a/pcap/pcap.h +++ b/pcap/pcap.h @@ -68,6 +68,7 @@ extern "C" { @@ -131,11 +130,11 @@ /* * Compatibility for systems that have a bpf.h that -@@ -276,6 +277,7 @@ int pcap_can_set_rfmon(pcap_t *); - int pcap_set_rfmon(pcap_t *, int); +@@ -280,6 +281,7 @@ int pcap_set_rfmon(pcap_t *, int); int pcap_set_timeout(pcap_t *, int); + int pcap_set_tstamp_type(pcap_t *, int); int pcap_set_buffer_size(pcap_t *, int); +int pcap_set_protocol(pcap_t *, unsigned short); int pcap_activate(pcap_t *); - pcap_t *pcap_open_live(const char *, int, int, int, char *); + int pcap_list_tstamp_types(pcap_t *, int **); |