OBS User unknown 2007-01-16 16:32:57 +00:00 committed by Git OBS Bridge
parent 3bfaf02efa
commit 30021e398c
3 changed files with 57 additions and 1 deletions

View File

@ -0,0 +1,47 @@
--- pcap-linux.c
+++ pcap-linux.c
@@ -1021,8 +1021,9 @@
handle->md.use_bpf = 1;
oldflags = fcntl(handle->fd, F_GETFL, 0);
- oldflags |= O_NONBLOCK;
- fcntl(handle->fd, F_SETFL, oldflags);
+ if (!(oldflags & O_NONBLOCK))
+ fcntl(handle->fd, F_SETFL, oldflags | O_NONBLOCK);
+
getsockopt(handle->fd, SOL_SOCKET, SO_RCVBUF,
(char *)&rec_len, &optlen);
@@ -1031,11 +1032,9 @@
&& received < rec_len) {
received += ret;
}
-
- if(oldflags > 0) {
- oldflags &= ~O_NONBLOCK;
+
+ if(!(oldflags & O_NONBLOCK))
fcntl(handle->fd, F_SETFL, oldflags);
- }
}
else if (err == -1) /* Non-fatal error */
{
@@ -1594,6 +1593,18 @@
}
}
+ if (to_ms > 0) {
+ struct timeval timeout;
+ timeout.tv_sec = to_ms / 1000;
+ timeout.tv_usec = (to_ms * 1000) % 1000000;
+ if (setsockopt(sock_fd, SOL_SOCKET, SO_RCVTIMEO,
+ &timeout, sizeof(timeout)) == -1) {
+ snprintf(ebuf, PCAP_ERRBUF_SIZE,
+ "setsockopt: %s", pcap_strerror(errno));
+ break;
+ };
+ }
+
/* Save the socket FD in the pcap structure */
handle->fd = sock_fd;

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Jan 16 15:18:20 CET 2007 - prusnak@suse.cz
- implemented socket timeout (socket-timeout.diff) [#234034]
-------------------------------------------------------------------
Wed Jan 3 15:25:29 CET 2007 - prusnak@suse.cz

View File

@ -12,7 +12,7 @@
Name: libpcap
Version: 0.9.5
Release: 1
Release: 4
Autoreqprov: on
Group: System/Libraries
License: BSD License and BSD-like
@ -23,6 +23,7 @@ Patch: %{name}-%{version}-shared.diff
Patch1: %{name}-%{version}-filter-fix.diff
Patch2: %{name}-%{version}-config.diff
Patch4: %{name}-%{version}-nonvoid.diff
Patch5: %{name}-%{version}-socket-timeout.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@ -52,6 +53,7 @@ Authors:
%patch1
%patch2
%patch4
%patch5
%build
%{suse_update_config -f}
@ -83,6 +85,8 @@ rm -rf $RPM_BUILD_ROOT
%{_includedir}/*
%changelog -n libpcap
* Tue Jan 16 2007 - prusnak@suse.cz
- implemented socket timeout (socket-timeout.diff) [#234034]
* Wed Jan 03 2007 - prusnak@suse.cz
- update to 0.9.5
* Support for LAPD frames with vISDN