search for: process_receive_event

Displaying 10 results from an estimated 10 matches for "process_receive_event".

2011 Mar 28
5
[PATCH 1/3] Only peek and discard packets from specified device.
..._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_receive_event(s, now); + if (ret == 0) { + packet_discard(s->dev); + } break; } } - - if (ret == 0) - packet_discard(); - return ret; } diff --git a/usr/kinit/ipconfig/packet.c b/usr/kinit/ipconfig/packet.c index 84267b7..993a2fa 100644 --- a/usr/kinit/ipconfig/packet.c +++ b/usr/kinit/i...
2008 Jun 14
2
PATCH: ipconfig may discard useful packets
...d 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 discard_pkt, in which case it *discards* the packet and returns 0. This return value (0) will propagate to main, so (nr == 0) and packet_discard() will be called *again*, causing...
2003 Apr 29
0
[PATCH] Fix busy-looping behaviour in ipconfig
...e; @@ -57,6 +60,9 @@ static void configure_device(struct netdev *dev) { + if (do_not_config) + return; + if (netdev_setaddress(dev)) printf("IP-Config: failed to set addresses on %s\n", dev->name); if (netdev_setdefaultroute(dev)) @@ -118,8 +124,10 @@ } } -static void process_receive_event(struct state *s, time_t now) +static int process_receive_event(struct state *s, time_t now) { + int handled = 1; + switch (s->state) { case DEVST_BOOTP: s->restart_state = DEVST_BOOTP; @@ -173,8 +181,12 @@ case DEVST_ERROR: /* error occurred, try again in 10 seconds */ s->...
2011 Mar 27
4
ipconfig problem if multiple devices are up
...| for (s = slist; s; s = s->next) { | - if (s->dev->ifindex == ifindex) { | + dprintf("ifindex: %d - s->dev>ifindex: %d - %s\n",ifindex, s->de | + if (s->dev->ifindex == (ifindex)) { | ret = process_receive_event(s, now); | break; | } | `---- And the output is (for ipconfig tap1): ifindex: 1105 - s->dev>ifindex: 1106 - tap1 (1105 is tap0) If you delete on of the two devices (tunctl -d tap0 / don't forget to kill the corresponding vde_plug2tap process) eve...
2017 Feb 04
0
[PATCH] ipconfig: handle multiple interfaces correctly
...= 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[i].revents & POLLRDNORM) { + ret |= process_receive_event(s, now); + nr--; + } + } return ret; } static int loop(void) { -#define NR_FDS 1 - struct pollfd fds[NR_FDS]; + struct pollfd *fds; struct...
2019 Jan 18
0
[klibc:master] ipconfig: handle multiple interfaces correctly
...= 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[i].revents & POLLRDNORM) { + ret |= process_receive_event(s, now); + nr--; + } + } return ret; } static int loop(void) { -#define NR_FDS 1 - struct pollfd fds[NR_FDS]; + struct pollfd *fds; struct...
2010 Aug 25
0
[patch] ipconfig fixes + run-init nit
...f (iph.ihl < 5 || iph.version != IPVERSION) goto discard_pkt; commit 47da4f6ab856250854465f88edc6d76ca0ba017b Author: Julien BLACHE <julien-externe.blache at edf.fr> Date: Tue Aug 10 13:57:41 2010 +0200 [klibc] ipconfig: fix infinite loop The first switch() statement in process_receive_event() did not handle the DEVST_ERROR state, causing the timeout to be endlessly increased by 10 seconds at each iteration in the second switch() statement. The second switch() statement is only here to catch state changes caused by the first one, so DEVST_ERROR must be caught b...
2009 Mar 12
1
the return value of packet_peek()
...s 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; } } bail: return ret; } we will not do the above for loop since we don't want the received packet. There are two questions: 1. Are you plan to make ipconfig work with network card which already have an ip? 2. Is it safely to change the return value to -1 in disca...
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
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