Accepting request 199025 from home:AndreasStieger:branches:Base:System

update to 1.4.0

OBS-URL: https://build.opensuse.org/request/show/199025
OBS-URL: https://build.opensuse.org/package/show/Base:System/libpcap?expand=0&rev=32
This commit is contained in:
Marcus Meissner 2013-09-20 15:13:12 +00:00 committed by Git OBS Bridge
parent d265e52164
commit 63172be653
7 changed files with 428 additions and 292 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:41cbd9ed68383afd9f1fda279cb78427d36879d9e34ee707e31a16a1afd872b9
size 608967

3
libpcap-1.4.0.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7c6a2a4f71e8ab09804e6b4fb3aff998c5583108ac42c0e2967eee8e1dbc7406
size 619045

BIN
libpcap-1.4.0.tar.gz.sig Normal file

Binary file not shown.

View File

@ -1,83 +1,27 @@
--- sf-pcap.c.orig
+++ sf-pcap.c
@@ -550,7 +550,7 @@ pcap_dump_open(pcap_t *p, const char *fn
fname = "standard output";
} else {
#if !defined(WIN32) && !defined(MSDOS)
- f = fopen(fname, "w");
+ f = fopen(fname, "we");
#else
f = fopen(fname, "wb");
#endif
--- pcap-linux.c.orig
+++ pcap-linux.c
@@ -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.)
*/
- sock_fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
+ sock_fd = socket(PF_PACKET, SOCK_RAW|SOCK_CLOEXEC, htons(ETH_P_ALL));
if (sock_fd == -1) {
(void)snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"socket: %s", pcap_strerror(errno));
@@ -1508,7 +1508,7 @@ pcap_read_packet(pcap_t *handle, pcap_ha
}
#if defined(HAVE_PACKET_AUXDATA) && defined(HAVE_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI)
- packet_len = recvmsg(handle->fd, &msg, MSG_TRUNC);
+ packet_len = recvmsg(handle->fd, &msg, MSG_TRUNC|MSG_CMSG_CLOEXEC);
#else /* defined(HAVE_PACKET_AUXDATA) && defined(HAVE_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI) */
fromlen = sizeof(from);
packet_len = recvfrom(
@@ -1976,7 +1976,7 @@ scan_sys_class_net(pcap_if_t **devlistp,
/*
* Create a socket from which to fetch interface information.
*/
- fd = socket(AF_INET, SOCK_DGRAM, 0);
+ fd = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, 0);
if (fd < 0) {
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
"socket: %s", pcap_strerror(errno));
@@ -2122,7 +2122,7 @@ scan_proc_net_dev(pcap_if_t **devlistp,
/*
* Create a socket from which to fetch interface information.
*/
- fd = socket(AF_INET, SOCK_DGRAM, 0);
+ fd = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, 0);
if (fd < 0) {
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
"socket: %s", pcap_strerror(errno));
@@ -2919,8 +2919,8 @@ activate_new(pcap_t *handle)
* try a SOCK_RAW socket for the raw interface.
*/
sock_fd = is_any_device ?
- socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_ALL)) :
- socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
+ socket(PF_PACKET, SOCK_DGRAM|SOCK_CLOEXEC, htons(ETH_P_ALL)) :
+ socket(PF_PACKET, SOCK_RAW|SOCK_CLOEXEC, htons(ETH_P_ALL));
if (sock_fd == -1) {
if (errno == EINVAL || errno == EAFNOSUPPORT) {
@@ -3036,7 +3036,7 @@ activate_new(pcap_t *handle)
"close: %s", pcap_strerror(errno));
return PCAP_ERROR;
}
- sock_fd = socket(PF_PACKET, SOCK_DGRAM,
+ sock_fd = socket(PF_PACKET, SOCK_DGRAM|SOCK_CLOEXEC,
htons(ETH_P_ALL));
if (sock_fd == -1) {
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
@@ -5065,7 +5065,7 @@ activate_old(pcap_t *handle)
/* Open the socket */
- handle->fd = socket(PF_INET, SOCK_PACKET, htons(ETH_P_ALL));
+ handle->fd = socket(PF_INET, SOCK_PACKET|SOCK_CLOEXEC, htons(ETH_P_ALL));
if (handle->fd == -1) {
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"socket: %s", pcap_strerror(errno));
--- configure.in.orig
+++ configure.in
---
configure.in | 4 +++-
fad-gifc.c | 2 +-
fad-glifc.c | 4 ++--
inet.c | 4 ++--
nametoaddr.c | 2 +-
pcap-bt-linux.c | 6 +++---
pcap-can-linux.c | 4 ++--
pcap-canusb-linux.c | 3 ++-
pcap-linux.c | 16 ++++++++--------
pcap-netfilter-linux.c | 4 ++--
pcap-nit.c | 2 +-
pcap-sita.c | 2 +-
pcap-snit.c | 4 ++--
pcap-snoop.c | 2 +-
pcap-usb-linux.c | 12 ++++++------
savefile.c | 2 +-
sf-pcap.c | 2 +-
17 files changed, 39 insertions(+), 36 deletions(-)
Index: libpcap-1.4.0/configure.in
===================================================================
--- libpcap-1.4.0.orig/configure.in 2013-03-25 14:51:40.000000000 +0000
+++ libpcap-1.4.0/configure.in 2013-09-13 20:17:59.000000000 +0100
@@ -22,7 +22,9 @@ AC_INIT(pcap.c)
AC_CANONICAL_SYSTEM
@ -89,27 +33,45 @@
AC_LBL_C_INIT(V_CCOPT, V_INCLS)
AC_LBL_SHLIBS_INIT
AC_LBL_C_INLINE
--- pcap-canusb-linux.c.orig
+++ pcap-canusb-linux.c
@@ -36,6 +36,7 @@
#include "config.h"
#endif
+#include <pthread.h>
#include <libusb-1.0/libusb.h>
#include "pcap-int.h"
@@ -264,7 +265,7 @@ static int canusb_startcapture(struct ca
{
int pipefd[2];
- if (pipe(pipefd) == -1) return -1;
+ if (pipe2(pipefd, O_CLOEXEC) == -1) return -1;
canusb.rdpipe = pipefd[0];
canusb.wrpipe = pipefd[1];
--- inet.c.orig
+++ inet.c
Index: libpcap-1.4.0/fad-gifc.c
===================================================================
--- libpcap-1.4.0.orig/fad-gifc.c 2013-02-21 03:51:49.000000000 +0000
+++ libpcap-1.4.0/fad-gifc.c 2013-09-13 20:17:59.000000000 +0100
@@ -157,7 +157,7 @@ pcap_findalldevs_interfaces(pcap_if_t **
/*
* Create a socket from which to fetch the list of interfaces.
*/
- fd = socket(AF_INET, SOCK_DGRAM, 0);
+ fd = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, 0);
if (fd < 0) {
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
"socket: %s", pcap_strerror(errno));
Index: libpcap-1.4.0/fad-glifc.c
===================================================================
--- libpcap-1.4.0.orig/fad-glifc.c 2013-02-21 03:51:49.000000000 +0000
+++ libpcap-1.4.0/fad-glifc.c 2013-09-13 20:17:59.000000000 +0100
@@ -100,7 +100,7 @@ pcap_findalldevs_interfaces(pcap_if_t **
* Create a socket from which to fetch the list of interfaces,
* and from which to fetch IPv4 information.
*/
- fd4 = socket(AF_INET, SOCK_DGRAM, 0);
+ fd4 = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, 0);
if (fd4 < 0) {
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
"socket: %s", pcap_strerror(errno));
@@ -110,7 +110,7 @@ pcap_findalldevs_interfaces(pcap_if_t **
/*
* Create a socket from which to fetch IPv6 information.
*/
- fd6 = socket(AF_INET6, SOCK_DGRAM, 0);
+ fd6 = socket(AF_INET6, SOCK_DGRAM|SOCK_CLOEXEC, 0);
if (fd6 < 0) {
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
"socket: %s", pcap_strerror(errno));
Index: libpcap-1.4.0/inet.c
===================================================================
--- libpcap-1.4.0.orig/inet.c 2013-02-21 03:51:49.000000000 +0000
+++ libpcap-1.4.0/inet.c 2013-09-13 20:17:59.000000000 +0100
@@ -430,7 +430,7 @@ add_addr_to_iflist(pcap_if_t **alldevs,
*/
memset(&ifrdesc, 0, sizeof ifrdesc);
@ -128,9 +90,167 @@
if (fd < 0) {
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE, "socket: %s",
pcap_strerror(errno));
--- pcap-netfilter-linux.c.orig
+++ pcap-netfilter-linux.c
@@ -363,7 +363,7 @@ nflog_activate(pcap_t* handle)
Index: libpcap-1.4.0/nametoaddr.c
===================================================================
--- libpcap-1.4.0.orig/nametoaddr.c 2013-02-21 03:51:49.000000000 +0000
+++ libpcap-1.4.0/nametoaddr.c 2013-09-13 20:17:59.000000000 +0100
@@ -441,7 +441,7 @@ pcap_ether_hostton(const char *name)
static int init = 0;
if (!init) {
- fp = fopen(PCAP_ETHERS_FILE, "r");
+ fp = fopen(PCAP_ETHERS_FILE, "re");
++init;
if (fp == NULL)
return (NULL);
Index: libpcap-1.4.0/pcap-bt-linux.c
===================================================================
--- libpcap-1.4.0.orig/pcap-bt-linux.c 2013-03-25 14:51:40.000000000 +0000
+++ libpcap-1.4.0/pcap-bt-linux.c 2013-09-13 20:19:44.000000000 +0100
@@ -79,7 +79,7 @@ bt_findalldevs(pcap_if_t **alldevsp, cha
int i, sock;
int ret = 0;
- sock = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
+ sock = socket(AF_BLUETOOTH, SOCK_RAW|SOCK_CLOEXEC, BTPROTO_HCI);
if (sock < 0)
{
/* if bluetooth is not supported this this is not fatal*/
@@ -211,7 +211,7 @@ bt_activate(pcap_t* handle)
handle->md.ifindex = dev_id;
/* Create HCI socket */
- handle->fd = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
+ handle->fd = socket(AF_BLUETOOTH, SOCK_RAW|SOCK_CLOEXEC, BTPROTO_HCI);
if (handle->fd < 0) {
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"Can't create raw socket: %s", strerror(errno));
@@ -315,7 +315,7 @@ bt_read_linux(pcap_t *handle, int max_pa
/* ignore interrupt system call error */
do {
- ret = recvmsg(handle->fd, &msg, 0);
+ ret = recvmsg(handle->fd, &msg, MSG_CMSG_CLOEXEC);
if (handle->break_loop)
{
handle->break_loop = 0;
Index: libpcap-1.4.0/pcap-can-linux.c
===================================================================
--- libpcap-1.4.0.orig/pcap-can-linux.c 2013-02-21 03:51:49.000000000 +0000
+++ libpcap-1.4.0/pcap-can-linux.c 2013-09-13 20:17:59.000000000 +0100
@@ -153,7 +153,7 @@ can_activate(pcap_t* handle)
handle->stats_op = can_stats_linux;
/* Create socket */
- handle->fd = socket(PF_CAN, SOCK_RAW, CAN_RAW);
+ handle->fd = socket(PF_CAN, SOCK_RAW|SOCK_CLOEXEC, CAN_RAW);
if (handle->fd < 0)
{
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't create raw socket %d:%s",
@@ -227,7 +227,7 @@ can_read_linux(pcap_t *handle, int max_p
do
{
- pkth.caplen = recvmsg(handle->fd, &msg, 0);
+ pkth.caplen = recvmsg(handle->fd, &msg, MSG_CMSG_CLOEXEC);
if (handle->break_loop)
{
handle->break_loop = 0;
Index: libpcap-1.4.0/pcap-canusb-linux.c
===================================================================
--- libpcap-1.4.0.orig/pcap-canusb-linux.c 2013-02-21 03:51:49.000000000 +0000
+++ libpcap-1.4.0/pcap-canusb-linux.c 2013-09-13 20:21:19.000000000 +0100
@@ -36,6 +36,7 @@
#include "config.h"
#endif
+#include <pthread.h>
#include <libusb-1.0/libusb.h>
#include "pcap-int.h"
@@ -297,7 +298,7 @@ static int canusb_startcapture(struct ca
{
int pipefd[2];
- if (pipe(pipefd) == -1)
+ if (pipe2(pipefd, O_CLOEXEC) == -1)
return -1;
canusb.rdpipe = pipefd[0];
Index: libpcap-1.4.0/pcap-linux.c
===================================================================
--- libpcap-1.4.0.orig/pcap-linux.c 2013-09-13 20:15:43.000000000 +0100
+++ libpcap-1.4.0/pcap-linux.c 2013-09-13 20:17:59.000000000 +0100
@@ -894,7 +894,7 @@ pcap_can_set_rfmon_linux(pcap_t *handle)
* (We assume that if we have Wireless Extensions support
* we also have PF_PACKET support.)
*/
- sock_fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
+ sock_fd = socket(PF_PACKET, SOCK_RAW|SOCK_CLOEXEC, htons(ETH_P_ALL));
if (sock_fd == -1) {
(void)snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"socket: %s", pcap_strerror(errno));
@@ -1422,7 +1422,7 @@ pcap_read_packet(pcap_t *handle, pcap_ha
}
#if defined(HAVE_PACKET_AUXDATA) && defined(HAVE_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI)
- packet_len = recvmsg(handle->fd, &msg, MSG_TRUNC);
+ packet_len = recvmsg(handle->fd, &msg, MSG_TRUNC|MSG_CMSG_CLOEXEC);
#else /* defined(HAVE_PACKET_AUXDATA) && defined(HAVE_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI) */
fromlen = sizeof(from);
packet_len = recvfrom(
@@ -1900,7 +1900,7 @@ scan_sys_class_net(pcap_if_t **devlistp,
/*
* Create a socket from which to fetch interface information.
*/
- fd = socket(AF_INET, SOCK_DGRAM, 0);
+ fd = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, 0);
if (fd < 0) {
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
"socket: %s", pcap_strerror(errno));
@@ -2077,7 +2077,7 @@ scan_proc_net_dev(pcap_if_t **devlistp,
/*
* Create a socket from which to fetch interface information.
*/
- fd = socket(AF_INET, SOCK_DGRAM, 0);
+ fd = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, 0);
if (fd < 0) {
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
"socket: %s", pcap_strerror(errno));
@@ -2824,8 +2824,8 @@ activate_new(pcap_t *handle)
* try a SOCK_RAW socket for the raw interface.
*/
sock_fd = is_any_device ?
- socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_ALL)) :
- socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
+ socket(PF_PACKET, SOCK_DGRAM|SOCK_CLOEXEC, htons(ETH_P_ALL)) :
+ socket(PF_PACKET, SOCK_RAW|SOCK_CLOEXEC, htons(ETH_P_ALL));
if (sock_fd == -1) {
if (errno == EINVAL || errno == EAFNOSUPPORT) {
@@ -2941,7 +2941,7 @@ activate_new(pcap_t *handle)
"close: %s", pcap_strerror(errno));
return PCAP_ERROR;
}
- sock_fd = socket(PF_PACKET, SOCK_DGRAM,
+ sock_fd = socket(PF_PACKET, SOCK_DGRAM|SOCK_CLOEXEC,
htons(ETH_P_ALL));
if (sock_fd == -1) {
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
@@ -4988,7 +4988,7 @@ activate_old(pcap_t *handle)
/* Open the socket */
- handle->fd = socket(PF_INET, SOCK_PACKET, htons(ETH_P_ALL));
+ handle->fd = socket(PF_INET, SOCK_PACKET|SOCK_CLOEXEC, htons(ETH_P_ALL));
if (handle->fd == -1) {
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"socket: %s", pcap_strerror(errno));
Index: libpcap-1.4.0/pcap-netfilter-linux.c
===================================================================
--- libpcap-1.4.0.orig/pcap-netfilter-linux.c 2013-02-21 03:51:49.000000000 +0000
+++ libpcap-1.4.0/pcap-netfilter-linux.c 2013-09-13 20:17:59.000000000 +0100
@@ -478,7 +478,7 @@ netfilter_activate(pcap_t* handle)
handle->stats_op = netfilter_stats_linux;
/* Create netlink socket */
@ -139,7 +259,7 @@
if (handle->fd < 0) {
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't create raw socket %d:%s", errno, pcap_strerror(errno));
return PCAP_ERROR;
@@ -450,7 +450,7 @@ netfilter_platform_finddevs(pcap_if_t **
@@ -626,7 +626,7 @@ netfilter_findalldevs(pcap_if_t **alldev
pcap_if_t *found_dev = *alldevsp;
int sock;
@ -148,19 +268,36 @@
if (sock < 0) {
/* if netlink is not supported this is not fatal */
if (errno == EAFNOSUPPORT || errno == EPROTONOSUPPORT)
--- savefile.c.orig
+++ savefile.c
@@ -189,7 +189,7 @@ pcap_open_offline(const char *fname, cha
Index: libpcap-1.4.0/pcap-nit.c
===================================================================
--- libpcap-1.4.0.orig/pcap-nit.c 2013-02-21 03:51:49.000000000 +0000
+++ libpcap-1.4.0/pcap-nit.c 2013-09-13 20:17:59.000000000 +0100
@@ -259,7 +259,7 @@ pcap_activate_nit(pcap_t *p)
p->snapshot = 96;
memset(p, 0, sizeof(*p));
- p->fd = fd = socket(AF_NIT, SOCK_RAW, NITPROTO_RAW);
+ p->fd = fd = socket(AF_NIT, SOCK_RAW|SOCK_CLOEXEC, NITPROTO_RAW);
if (fd < 0) {
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"socket: %s", pcap_strerror(errno));
Index: libpcap-1.4.0/pcap-sita.c
===================================================================
--- libpcap-1.4.0.orig/pcap-sita.c 2013-02-21 03:51:49.000000000 +0000
+++ libpcap-1.4.0/pcap-sita.c 2013-09-13 20:17:59.000000000 +0100
@@ -329,7 +329,7 @@ static int open_with_IOP(unit_t *u, int
u->serv_addr->sin_addr.s_addr = inet_addr(ip);
u->serv_addr->sin_port = htons(IOP_SNIFFER_PORT);
- if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+ if ((sockfd = socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, 0)) < 0) {
fprintf(stderr, "pcap can't open a socket for connecting to IOP at %s\n", ip);
return 0;
}
else {
#if !defined(WIN32) && !defined(MSDOS)
- fp = fopen(fname, "r");
+ fp = fopen(fname, "re");
#else
fp = fopen(fname, "rb");
#endif
--- pcap-snit.c.orig
+++ pcap-snit.c
Index: libpcap-1.4.0/pcap-snit.c
===================================================================
--- libpcap-1.4.0.orig/pcap-snit.c 2013-02-21 03:51:49.000000000 +0000
+++ libpcap-1.4.0/pcap-snit.c 2013-09-13 20:17:59.000000000 +0100
@@ -297,9 +297,9 @@ pcap_activate_snit(pcap_t *p)
* the device in question) can be indicated at open
* time.
@ -173,148 +310,10 @@
if (fd < 0) {
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "%s: %s", dev,
pcap_strerror(errno));
--- fad-glifc.c.orig
+++ fad-glifc.c
@@ -100,7 +100,7 @@ pcap_findalldevs(pcap_if_t **alldevsp, c
* Create a socket from which to fetch the list of interfaces,
* and from which to fetch IPv4 information.
*/
- fd4 = socket(AF_INET, SOCK_DGRAM, 0);
+ fd4 = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, 0);
if (fd4 < 0) {
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
"socket: %s", pcap_strerror(errno));
@@ -110,7 +110,7 @@ pcap_findalldevs(pcap_if_t **alldevsp, c
/*
* Create a socket from which to fetch IPv6 information.
*/
- fd6 = socket(AF_INET6, SOCK_DGRAM, 0);
+ fd6 = socket(AF_INET6, SOCK_DGRAM|SOCK_CLOEXEC, 0);
if (fd6 < 0) {
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
"socket: %s", pcap_strerror(errno));
--- pcap-nit.c.orig
+++ pcap-nit.c
@@ -259,7 +259,7 @@ pcap_activate_nit(pcap_t *p)
p->snapshot = 96;
memset(p, 0, sizeof(*p));
- p->fd = fd = socket(AF_NIT, SOCK_RAW, NITPROTO_RAW);
+ p->fd = fd = socket(AF_NIT, SOCK_RAW|SOCK_CLOEXEC, NITPROTO_RAW);
if (fd < 0) {
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"socket: %s", pcap_strerror(errno));
--- pcap-sita.c.orig
+++ pcap-sita.c
@@ -318,7 +318,7 @@ static int open_with_IOP(unit_t *u, int
u->serv_addr->sin_addr.s_addr = inet_addr(ip);
u->serv_addr->sin_port = htons(IOP_SNIFFER_PORT);
- if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+ if ((sockfd = socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, 0)) < 0) {
fprintf(stderr, "pcap can't open a socket for connecting to IOP at %s\n", ip);
return 0;
}
--- pcap-can-linux.c.orig
+++ pcap-can-linux.c
@@ -106,7 +106,7 @@ can_activate(pcap_t* handle)
handle->stats_op = can_stats_linux;
/* Create socket */
- handle->fd = socket(PF_CAN, SOCK_RAW, CAN_RAW);
+ handle->fd = socket(PF_CAN, SOCK_RAW|SOCK_CLOEXEC, CAN_RAW);
if (handle->fd < 0)
{
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't create raw socket %d:%s",
@@ -180,7 +180,7 @@ can_read_linux(pcap_t *handle, int max_p
do
{
- pkth.caplen = recvmsg(handle->fd, &msg, 0);
+ pkth.caplen = recvmsg(handle->fd, &msg, MSG_CMSG_CLOEXEC);
if (handle->break_loop)
{
handle->break_loop = 0;
--- fad-gifc.c.orig
+++ fad-gifc.c
@@ -156,7 +156,7 @@ pcap_findalldevs(pcap_if_t **alldevsp, c
/*
* Create a socket from which to fetch the list of interfaces.
*/
- fd = socket(AF_INET, SOCK_DGRAM, 0);
+ fd = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, 0);
if (fd < 0) {
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
"socket: %s", pcap_strerror(errno));
--- nametoaddr.c.orig
+++ nametoaddr.c
@@ -440,7 +440,7 @@ pcap_ether_hostton(const char *name)
static int init = 0;
if (!init) {
- fp = fopen(PCAP_ETHERS_FILE, "r");
+ fp = fopen(PCAP_ETHERS_FILE, "re");
++init;
if (fp == NULL)
return (NULL);
--- pcap-usb-linux.c.orig
+++ pcap-usb-linux.c
@@ -252,7 +252,7 @@ probe_devices(int bus)
snprintf(buf, sizeof(buf), "/dev/bus/usb/%03d/%s", bus, data->d_name);
- fd = open(buf, O_RDWR);
+ fd = open(buf, O_RDWR|O_CLOEXEC);
if (fd == -1)
continue;
@@ -323,7 +323,7 @@ usb_activate(pcap_t* handle)
/*now select the read method: try to open binary interface */
snprintf(full_path, USB_LINE_LEN, LINUX_USB_MON_DEV"%d", handle->md.ifindex);
- handle->fd = open(full_path, O_RDONLY, 0);
+ handle->fd = open(full_path, O_RDONLY|O_CLOEXEC, 0);
if (handle->fd >= 0)
{
if (handle->opt.rfmon) {
@@ -358,7 +358,7 @@ usb_activate(pcap_t* handle)
else {
/*Binary interface not available, try open text interface */
snprintf(full_path, USB_LINE_LEN, USB_TEXT_DIR"/%dt", handle->md.ifindex);
- handle->fd = open(full_path, O_RDONLY, 0);
+ handle->fd = open(full_path, O_RDONLY|O_CLOEXEC, 0);
if (handle->fd < 0)
{
if (errno == ENOENT)
@@ -368,7 +368,7 @@ usb_activate(pcap_t* handle)
* the old location.
*/
snprintf(full_path, USB_LINE_LEN, USB_TEXT_DIR_OLD"/%dt", handle->md.ifindex);
- handle->fd = open(full_path, O_RDONLY, 0);
+ handle->fd = open(full_path, O_RDONLY|O_CLOEXEC, 0);
}
if (handle->fd < 0) {
/* no more fallback, give it up*/
@@ -634,7 +634,7 @@ usb_stats_linux(pcap_t *handle, struct p
int fd;
snprintf(string, USB_LINE_LEN, USB_TEXT_DIR"/%ds", handle->md.ifindex);
- fd = open(string, O_RDONLY, 0);
+ fd = open(string, O_RDONLY|O_CLOEXEC, 0);
if (fd < 0)
{
if (errno == ENOENT)
@@ -644,7 +644,7 @@ usb_stats_linux(pcap_t *handle, struct p
* location.
*/
snprintf(string, USB_LINE_LEN, USB_TEXT_DIR_OLD"/%ds", handle->md.ifindex);
- fd = open(string, O_RDONLY, 0);
+ fd = open(string, O_RDONLY|O_CLOEXEC, 0);
}
if (fd < 0) {
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
--- pcap-snoop.c.orig
+++ pcap-snoop.c
Index: libpcap-1.4.0/pcap-snoop.c
===================================================================
--- libpcap-1.4.0.orig/pcap-snoop.c 2013-02-21 03:51:49.000000000 +0000
+++ libpcap-1.4.0/pcap-snoop.c 2013-09-13 20:17:59.000000000 +0100
@@ -205,7 +205,7 @@ pcap_activate_snoop(pcap_t *p)
int snooplen;
struct ifreq ifr;
@ -324,32 +323,87 @@
if (fd < 0) {
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "snoop socket: %s",
pcap_strerror(errno));
--- pcap-bt-linux.c.orig
+++ pcap-bt-linux.c
@@ -79,7 +79,7 @@ bt_platform_finddevs(pcap_if_t **alldevs
int i, sock;
int ret = 0;
- sock = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
+ sock = socket(AF_BLUETOOTH, SOCK_RAW|SOCK_CLOEXEC, BTPROTO_HCI);
if (sock < 0)
{
/* if bluetooth is not supported this this is not fatal*/
@@ -181,7 +181,7 @@ bt_activate(pcap_t* handle)
handle->md.ifindex = dev_id;
/* Create HCI socket */
- handle->fd = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
+ handle->fd = socket(AF_BLUETOOTH, SOCK_RAW|SOCK_CLOEXEC, BTPROTO_HCI);
if (handle->fd < 0) {
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"Can't create raw socket: %s", strerror(errno));
@@ -282,7 +282,7 @@ bt_read_linux(pcap_t *handle, int max_pa
Index: libpcap-1.4.0/pcap-usb-linux.c
===================================================================
--- libpcap-1.4.0.orig/pcap-usb-linux.c 2013-02-21 03:51:49.000000000 +0000
+++ libpcap-1.4.0/pcap-usb-linux.c 2013-09-13 20:17:59.000000000 +0100
@@ -252,7 +252,7 @@ probe_devices(int bus)
/* ignore interrupt system call error */
do {
- ret = recvmsg(handle->fd, &msg, 0);
+ ret = recvmsg(handle->fd, &msg, MSG_CMSG_CLOEXEC);
if (handle->break_loop)
snprintf(buf, sizeof(buf), "/dev/bus/usb/%03d/%s", bus, data->d_name);
- fd = open(buf, O_RDWR);
+ fd = open(buf, O_RDWR|O_CLOEXEC);
if (fd == -1)
continue;
@@ -353,7 +353,7 @@ usb_activate(pcap_t* handle)
/*now select the read method: try to open binary interface */
snprintf(full_path, USB_LINE_LEN, LINUX_USB_MON_DEV"%d", handle->md.ifindex);
- handle->fd = open(full_path, O_RDONLY, 0);
+ handle->fd = open(full_path, O_RDONLY|O_CLOEXEC, 0);
if (handle->fd >= 0)
{
if (handle->opt.rfmon) {
@@ -388,7 +388,7 @@ usb_activate(pcap_t* handle)
else {
/*Binary interface not available, try open text interface */
snprintf(full_path, USB_LINE_LEN, USB_TEXT_DIR"/%dt", handle->md.ifindex);
- handle->fd = open(full_path, O_RDONLY, 0);
+ handle->fd = open(full_path, O_RDONLY|O_CLOEXEC, 0);
if (handle->fd < 0)
{
handle->break_loop = 0;
if (errno == ENOENT)
@@ -398,7 +398,7 @@ usb_activate(pcap_t* handle)
* the old location.
*/
snprintf(full_path, USB_LINE_LEN, USB_TEXT_DIR_OLD"/%dt", handle->md.ifindex);
- handle->fd = open(full_path, O_RDONLY, 0);
+ handle->fd = open(full_path, O_RDONLY|O_CLOEXEC, 0);
}
if (handle->fd < 0) {
/* no more fallback, give it up*/
@@ -664,7 +664,7 @@ usb_stats_linux(pcap_t *handle, struct p
int fd;
snprintf(string, USB_LINE_LEN, USB_TEXT_DIR"/%ds", handle->md.ifindex);
- fd = open(string, O_RDONLY, 0);
+ fd = open(string, O_RDONLY|O_CLOEXEC, 0);
if (fd < 0)
{
if (errno == ENOENT)
@@ -674,7 +674,7 @@ usb_stats_linux(pcap_t *handle, struct p
* location.
*/
snprintf(string, USB_LINE_LEN, USB_TEXT_DIR_OLD"/%ds", handle->md.ifindex);
- fd = open(string, O_RDONLY, 0);
+ fd = open(string, O_RDONLY|O_CLOEXEC, 0);
}
if (fd < 0) {
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
Index: libpcap-1.4.0/savefile.c
===================================================================
--- libpcap-1.4.0.orig/savefile.c 2013-02-21 03:51:49.000000000 +0000
+++ libpcap-1.4.0/savefile.c 2013-09-13 20:17:59.000000000 +0100
@@ -189,7 +189,7 @@ pcap_open_offline(const char *fname, cha
}
else {
#if !defined(WIN32) && !defined(MSDOS)
- fp = fopen(fname, "r");
+ fp = fopen(fname, "re");
#else
fp = fopen(fname, "rb");
#endif
Index: libpcap-1.4.0/sf-pcap.c
===================================================================
--- libpcap-1.4.0.orig/sf-pcap.c 2013-02-21 03:51:49.000000000 +0000
+++ libpcap-1.4.0/sf-pcap.c 2013-09-13 20:17:59.000000000 +0100
@@ -550,7 +550,7 @@ pcap_dump_open(pcap_t *p, const char *fn
fname = "standard output";
} else {
#if !defined(WIN32) && !defined(MSDOS)
- f = fopen(fname, "w");
+ f = fopen(fname, "we");
#else
f = fopen(fname, "wb");
#endif

View File

@ -1,3 +1,40 @@
-------------------------------------------------------------------
Fri Sep 13 19:35:02 UTC 2013 - andreas.stieger@gmx.de
- update to 1.4.0:
* add netfilter/nfqueue interface
* support IPv6 filter expressions when no IPv6 address resolution
availavle
* Fix pcap-config to include -lpthread if canusb support is
present
* Try to fix "pcap_parse not defined" problems when --without-flex
and --without-bison are used when you have Flex and Bison
* Fix some issues with the pcap_loop man page.
* Fix pcap_getnonblock() and pcap_setnonblock() to fill in the
supplied error message buffer
* Fix typo that, it appeared, would cause pcap-libdlpi.c not to
compile (perhaps systems with libdlpi also have BPF and use
that instead)
* Catch attempts to call pcap_compile() on a non-activated pcap_t
* Fix crash on Linux with CAN-USB support without usbfs
* Fix addition of VLAN tags for Linux cooked captures
* Check for both EOPNOTSUPP and EINVAL after SIOCETHTOOL ioctl, so
that the driver can report either one if it doesn't support
SIOCETHTOOL
* Add DLT_INFINIBAND and DLT_SCTP
* Describe "proto XXX" and "protochain XXX" in the pcap-filter man
page
* Handle either directories, or symlinks to directories, that
correspond to interfaces in /sys/class/net
* Fix handling of VLAN tag insertion to check, on Linux 3.x
kernels, for VLAN tag valid flag
* Clean up some man pages
* Support libnl3 as well as libnl1 and libnl2 on Linux
- packaging changes:
* build with libnl
* refresh libpcap-ocloexec.patch for upstream changes
* verify source signatures
-------------------------------------------------------------------
Mon Aug 27 01:52:32 UTC 2012 - crrodriguez@opensuse.org

31
libpcap.keyring Normal file
View File

@ -0,0 +1,31 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.12 (GNU/Linux)
mQGRBFGRD2gBDCDcthM1N9jeWic9tD17LsHwWyh/IelKgFMVFShgHk31YsQUetKn
5hGKlW0WU7+r3dsECiqxgyuqeUKvqiZneqma0GDk1n8ucXLc7oFFLrF7qbvssPPM
831014FlzsN82OZZ1SnNUGacdyNzV5myPybKILWemsLuAJaGU60IkAJkTReiaMFR
pB0QmBiqM5KY2SHAkeja2+UhupBw/lHyAwU/KVhkohmvUTJeUBJaKK2gRY7jJQmf
ouTbIe0nKIqDzMmE9GvFhyQmMJzbxAwTfSxSZq3bMCpsyQtjoi2LGQFoMVkI6g7K
IRNWgCqSTHF238VIdOkLzbwuoZAmS+oacXszIln2jLJsKkbiCCOb/lV+5u5O6/wJ
M4RHxCBnkRgBmMLyXSM9qAo1FU5suPqf01msqvKMsa99lTF6kIWurR/7rw4S2bNl
iaMqHNHliFNfaAE42S8as+Pw5Rhq2SJczWyd8rYw/q1IIZyKLO1oGn6ZRt+EQ7BS
8nlREmT/MDqP0rgrpvRrABEBAAG0PVRoZSBUY3BkdW1wIEdyb3VwIChQYWNrYWdl
IHNpZ25pbmcga2V5KSA8cmVsZWFzZUB0Y3BkdW1wLm9yZz6JAcIEEwECACgFAlGR
D2gCGwMFCRLMAwAGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEOCJ3vHZwV0N
wPAMH22fmTbjByMSvR/gxDFA26ULgf02qZzqYlRLKB7EDbEjB1Ga6PrLB22Sn/b5
8fxNw/9zH0EPkorv0YnBhinE51jLmZ99Sk5eGFIMcCkNAOOhadFZGGKarekEPwNB
oDtxCuSuOQ0JVvyn5fLcbA5u3+LBvHvbnUKgCpiXahpq15bZiS1aoVkdXknUQVO+
bU6Y2lj3m8Q1C6t+J29UvbyixgQhFeTkl25NZkTS6Cqds5F9q3nUBD/7gvQbATBy
A+p+iWLHqt1s4c5UHRzriuLyBbnJgOEI13pNbgFIoKhbCSGQj0uQVZORmzzqs0nh
QXtj+JPOAMd619mHjmhXItgqu2llywQ36tXTEdRoUjJmgMkoqXtZQ8XDVdJ6f/sG
OJDHCctr5aVanWierzePl1PvWPWeC9mnB6Nnxuah+8zQFb4wXUnYO09OX47UgQlu
mE9/lZfY7okIODVrXjqbPVxSBLzCzptBrkeZ3brkrl5oCdYlWsUiQCY0hO6jzMEd
CnxEp1kkn2eJATAEEAECAAYFAlGaR8gACgkQbzNW3/yhb5DWLgigkgtM5wXCQkJz
VyXdCVTfdP9KXEZ1LM1NpRVHbk8lRmgWn4LHb2y1zmH8TDioAyz7GMSFDvqK5kqc
ZPOFi3YZOqLwtcYjAk+jW0ekmx7ao1fIsMjsTvAMVq/EKNRq8IeiKhJSD4KCttFa
qvtD5IfxlgsMoVAdsXF0tyTtC457zWCof3FP7Wbm3MRN3TV4eJInEZhKFgLt4xM6
dCI4ifizu4aPe/TptNl+MuyYTXmPghkQgoeTB9b2qhklp5ccX+8HYeWrpMuCM4er
YYG/j5tZ5YJ/13HDO7S22Wxp94h0hy7NgZ7DRXP0XGp5NvS1stLMGwPm6wyYsjtL
m+jWKltF1WFO1z8zSpZaC+u1GSe48qpqA40k
=1rmx
-----END PGP PUBLIC KEY BLOCK-----

View File

@ -1,7 +1,7 @@
#
# spec file for package libpcap
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -17,7 +17,7 @@
Name: libpcap
Version: 1.3.0
Version: 1.4.0
Release: 0
Summary: A Library for Network Sniffers
License: BSD-3-Clause
@ -25,6 +25,8 @@ Group: System/Libraries
Url: http://www.tcpdump.org/
Source: http://www.tcpdump.org/release/%{name}-%{version}.tar.gz
Source2: baselibs.conf
Source3: http://www.tcpdump.org/tcpdump-workers.asc#/%{name}.keyring
Source4: http://www.tcpdump.org/release/%{name}-%{version}.tar.gz.sig
Patch0: libpcap-1.0.0-filter-fix.patch
Patch1: libpcap-1.0.0-pcap-bpf.patch
Patch2: libpcap-1.0.0-ppp.patch
@ -35,6 +37,12 @@ BuildRequires: bison
BuildRequires: bluez-devel
BuildRequires: flex
BuildRequires: libusb-devel
%if %{?suse_version} >= 1210
BuildRequires: libnl3-devel
%endif
%if 0%{?suse_version} >= 1230
BuildRequires: gpg-offline
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@ -65,7 +73,12 @@ program yourself.
%package devel
Summary: A Library for Network Sniffers
Group: Development/Libraries/C and C++
Requires: bluez-devel
Requires: libpcap1 = %{version}
Requires: libusb-devel
%if %{?suse_version} >= 1210
Requires: libnl3-devel
%endif
%description devel
libpcap is a library used by packet sniffer programs. It provides an
@ -74,12 +87,13 @@ This package is only needed if you plan to compile or write such a
program yourself.
%prep
%{?gpg_verify: %gpg_verify %{S:4}}
%setup -q
%patch0
%patch1
%patch2
%patch3
%patch4
%patch4 -p1
%build
%ifarch %sparc
pic="PIC"