Displaying 13 results from an estimated 13 matches for "do_pkt_recv".
2011 Jun 14
0
[PATCH] ipconfig: do_pkt_recv() refix ret initialisation
...t/ipconfig/main.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/usr/kinit/ipconfig/main.c b/usr/kinit/ipconfig/main.c
index 4833bb7..6ad5588 100644
--- a/usr/kinit/ipconfig/main.c
+++ b/usr/kinit/ipconfig/main.c
@@ -343,7 +343,7 @@ struct netdev *ifaces;
*/
static int do_pkt_recv(int pkt_fd, time_t now)
{
- int ret;
+ int ret = 0;
struct state *s;
for (s = slist; s; s = s->next) {
--
1.7.5.3
2011 Mar 27
4
ipconfig problem if multiple devices are up
Hi,
it seems that ipconfig has a problem if multiple devices are up and
connected to the same network. It seems that it uses the wrong
socket/device index to compare it to incoming packet. To be more
precise, the packet gets discarded in do_pkt_recv as the ifindex from
state differs always from the incoming packet
To reproduce create two tap devices:
$ sudo tunctl -u uli -t tap0
Set 'tap0' persistent and owned by uid 1000
$ sudo tunctl -u uli -t tap1...
2003 Apr 29
0
[PATCH] Fix busy-looping behaviour in ipconfig
...2 @@
case DEVST_ERROR:
/* error occurred, try again in 10 seconds */
s->expire = now + 10;
+ default:
+ handled = 0;
break;
}
+
+ return handled;
}
static void process_timeout_event(struct state *s, time_t now)
@@ -231,20 +243,23 @@
static struct state *slist;
-static void do_pkt_recv(int pkt_fd, time_t now)
+static int do_pkt_recv(int pkt_fd, time_t now)
{
int ifindex, ret;
struct state *s;
ret = packet_peek(&ifindex);
if (ret < 0)
- return;
+ goto bail;
for (s = slist; s; s = s->next)
if (s->dev->ifindex == ifindex) {
- process_receive_eve...
2008 Jun 14
2
PATCH: ipconfig may discard useful packets
...ts an address in only a few msec.
Sorry, but this means that many functions were modified,
but in the good side, the return values were commented.
I did my best to avoid any regressions, but a second look
at the code or extra testing may be needed.
A scenario where the bug occurs:
In main.c:
nr = do_pkt_recv(pkt_fd, now.tv_sec);
if (nr == 1)
break;
else if (nr == 0)
packet_discard(); <== This one
The following functions may be called:
do_pkt_recv > process_receive_event > e.g. dhcp_recv_offer > dhcp_recv
> packet_recv
packet_recv may receive a not-appropriate packet, and jump to...
2017 Feb 04
0
[PATCH] ipconfig: handle multiple interfaces correctly
...ete_device(struct netdev *dev)
configure_device(dev);
dump_device_config(dev);
print_device_config(dev);
+ packet_close(dev);
++configured;
@@ -374,34 +376,36 @@ struct netdev *ifaces;
* 0 = No dhcp/bootp packet was received
* 1 = A packet was received and handled
*/
-static int do_pkt_recv(int pkt_fd, time_t now)
+static int do_pkt_recv(int nr, struct pollfd *fds, time_t now)
{
- int ret = 0;
+ int i, ret = 0;
struct state *s;
- for (s = slist; s; s = s->next)
- ret |= process_receive_event(s, now);
+ for (i = 0, s = slist; s && nr; s = s->next, i++) {
+ if (fds[...
2019 Jan 18
0
[klibc:master] ipconfig: handle multiple interfaces correctly
...ete_device(struct netdev *dev)
configure_device(dev);
dump_device_config(dev);
print_device_config(dev);
+ packet_close(dev);
++configured;
@@ -374,34 +376,36 @@ struct netdev *ifaces;
* 0 = No dhcp/bootp packet was received
* 1 = A packet was received and handled
*/
-static int do_pkt_recv(int pkt_fd, time_t now)
+static int do_pkt_recv(int nr, struct pollfd *fds, time_t now)
{
- int ret = 0;
+ int i, ret = 0;
struct state *s;
- for (s = slist; s; s = s->next)
- ret |= process_receive_event(s, now);
+ for (i = 0, s = slist; s && nr; s = s->next, i++) {
+ if (fds[...
2009 Mar 12
1
the return value of packet_peek()
...pkt;
+
+ if (iph.protocol != IPPROTO_UDP)
+ goto discard_pkt;
+
*ifindex = sll.sll_ifindex;
@@ -191,7 +197,7 @@
discard_pkt:
packet_discard();
- return 0;
+ return -1;
}
void packet_discard(void)
This will make packet_peek return -1 if the packet is not what we
want. and affect the do_pkt_recv() process
static int do_pkt_recv(int pkt_fd, time_t now)
{
int ifindex, ret;
struct state *s;
ret = packet_peek(&ifindex);
if (ret < 0)
goto bail;
for (s = slist; s; s = s->next) {
if (s->dev->ifindex == ifindex) {
ret |= process_receive_event(s, now);
break;
}...
2011 Mar 28
5
[PATCH 1/3] Only peek and discard packets from specified device.
...v, 3);
+ ret = packet_recv(dev, iov, 3);
if (ret <= 0)
return ret;
diff --git a/usr/kinit/ipconfig/main.c b/usr/kinit/ipconfig/main.c
index d501bec..1e48083 100644
--- a/usr/kinit/ipconfig/main.c
+++ b/usr/kinit/ipconfig/main.c
@@ -304,23 +304,19 @@ struct netdev *ifaces;
*/
static int do_pkt_recv(int pkt_fd, time_t now)
{
- int ifindex, ret;
+ int ret = 0;
struct state *s;
- ret = packet_peek(&ifindex);
- if (ret == 0)
- return ret;
-
for (s = slist; s; s = s->next) {
- if (s->dev->ifindex == ifindex) {
+ ret = packet_peek(s->dev);
+ if (ret) {
ret = process_r...
2017 Dec 31
4
[PATCH klibc 0/4] Fixes from Debian and Ubuntu
The following patches come from Debian and/or Ubuntu packages of
klibc.
Ben.
Ben Hutchings (1):
[klibc] run-init: Add dry-run mode
Jay Vosburgh (1):
[klibc] ipconfig: Use separate sockets for DHCP from multiple
interfaces
Mathieu Trudel-Lapierre (1):
[klibc] ipconfig: Set broadcast when sending DHCPREQUEST and
DHCPDISCOVER
YunQiang Su (1):
[klibc] mips: setjmp.S: don't
2003 Apr 29
0
[PATCH] Add configurable timeout to ipconfig
...int pending = 0;
@@ -308,8 +311,8 @@
for (x = 0; x < 2; x++) {
int delta_ms;
- if (timeout_ms <= 0)
- timeout_ms = 1;
+ if (timeout_ms <= 0 || loop_timeout == 0)
+ timeout_ms = 100;
nr = poll(fds, NR_FDS, timeout_ms);
prev = now;
@@ -319,6 +322,14 @@
do_pkt_recv(pkt_fd, now.tv_sec) == 1) {
break;
}
+
+ if (loop_timeout >= 0 &&
+ now.tv_sec - start >= loop_timeout) {
+ printf("IP-Config: no response after %d "
+ "secs - giving up\n", loop_timeout);
+ goto bail;
+ }
+
packet_discard(...
2011 Jul 27
0
klibc 1.5.24 release
...] strndup(): Do not corrupt the memory pool
Tim Harder (1):
[klibc] Kbuild: fix parallel make install error
Ulrich Dangel (1):
[klibc] ipconfig: Don't try to guess the nameserver
maximilian attems (19):
[klibc] 1.5.23 released, next version is 1.5.24
[klibc] ipconfig: do_pkt_recv() refix ret initialisation
[klibc] cpio: cleanup O_BINARY usage.
[klibc] cpio: directly include fnmatch
[klibc] fstpye: no need for braces around return values
[klibc] sleep: have argument on next line
[klibc] readklink: remove unneeded braces
[klibc] mount: whit...
2011 Dec 04
0
[GIT PULL] klibc minor fixes
...ae7..37ca573 100644
--- a/usr/kinit/ipconfig/main.c
+++ b/usr/kinit/ipconfig/main.c
@@ -408,7 +408,7 @@ static int loop(void)
prev = now;
gettimeofday(&now, NULL);
- if ((fds[0].revents & POLLRDNORM)) {
+ if ((nr > 0) && (fds[0].revents & POLLRDNORM)) {
if (do_pkt_recv(pkt_fd, now.tv_sec) == 1)
break;
}
commit 7f47891c1678874cccca66cd25e6a13486c86d78
Author: Maciej ?enczykowski <zenczykowski at gmail.com>
Date: Sun Nov 6 14:33:40 2011 -0800
[klibc] include: [sys/types.h] -> linux/types.h and __aligned_u64
When building klibc 1....
2011 Jul 08
4
[PATCH 0/4] usr/kinit checkpatch
Various coding style fixes checkpatch warns about.
The goal is not to be 100% checkpatch compliant,
but to have more consistent coding style.
As this is a trivial patch serie, will land in 24 hours in klibc git,
unless of course ml review hits a bugger.
Checked with size(3) that the generated kinit, fstype, ipconfig and
nfsmount are the same.
maximilian attems (4):
[klibc] ipconfig: reduce