Displaying 5 results from an estimated 5 matches for "packet_peek".
2009 Mar 12
1
the return value of packet_peek()
...packet in packet_recv() since we have a packet form checking
there:
if (ntohs(ip->tot_len) > ret || ip->protocol != IPPROTO_UDP)
goto free_pkt;
ip config will fall in a loop and always got the icmp packet instead
of DHCPOFFER packet in this situation.
If I change the retrun value of packet_peek and make a packet form
checking in more early stage, I can avoiding ipconfig fall in a loop
with icmp packet, like this:
--- /work/atcs/os_pkg/klibc-git/klibc/usr/kinit/ipconfig.old/packet.c 2009-03-11
15:30:45.000000000 +0800
+++ packet.c 2009-03-11 17:39:56.000000000 +0800
@@ -176,6 +176,8 @@...
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
2011 Mar 28
5
[PATCH 1/3] Only peek and discard packets from specified device.
This patch fixes a bug on systems with multiple connected network devices.
As packet_peek uses all devices to receive data instead of a specific
device. As the return value was never reset it was possible that packets
from other devices were returned by packet_peek. That means that the
ifindex did not match any ifindex of the specified devices the packet was
never removed and packets fo...
2008 Jun 14
2
PATCH: ipconfig may discard useful packets
...ent(struct state
*s, time_t now)
static struct state *slist;
struct netdev *ifaces;
+/*
+ * Returns:
+ * 0 = Error, packet not received or discarded
+ * 1 = A packet was received and handled
+ */
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;
+ if (ret == 0)
+ return ret;
for (s = slist; s; s = s->next) {
if (s->dev->ifindex == ifindex) {
- ret |= process_receive_event(s, now);
+ ret = process_receive_event(s, now);
break;
}
}
- bail:
+ if (ret == 0)
+ pa...
2003 Apr 29
0
[PATCH] Fix busy-looping behaviour in ipconfig
...k;
}
+
+ 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_event(s, now);
+ ret |= process_receive_event(s, now);
break;
}
+
+ bail:
+ return ret;
}
static int loop(void)
@@ -254,7 +269...