search for: pkt_fd

Displaying 15 results from an estimated 15 matches for "pkt_fd".

Did you mean: out_fd
2017 Feb 04
0
[PATCH] ipconfig: handle multiple interfaces correctly
...t 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[i].revents...
2019 Jan 18
0
[klibc:master] ipconfig: handle multiple interfaces correctly
...t 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[i].revents...
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] Fix busy-looping behaviour in ipconfig
...T_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_event(s, now);...
2003 Apr 29
0
[PATCH] Add configurable timeout to ipconfig
...ru a/ipconfig/main.c b/ipconfig/main.c --- a/ipconfig/main.c Tue Apr 29 13:03:14 2003 +++ b/ipconfig/main.c Tue Apr 29 13:03:14 2003 @@ -18,6 +18,7 @@ static const char *progname; static char do_not_config; +static int loop_timeout = -1; struct state { int state; @@ -270,6 +271,7 @@ int pkt_fd; int nr = 0; struct timeval now, prev; + time_t start; pkt_fd = packet_open(); if (pkt_fd == -1) { @@ -281,6 +283,7 @@ fds[0].events = POLLRDNORM; gettimeofday(&now, NULL); + start = now.tv_sec; while (1) { int timeout = 60; int pending = 0; @@ -308,8 +311,8 @@ for (x...
2008 Jun 14
2
PATCH: ipconfig may discard useful packets
...s 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 discard...
2011 Mar 28
5
[PATCH 1/3] Only peek and discard packets from specified device.
...acket_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_receive_even...
2011 Mar 27
4
ipconfig problem if multiple devices are up
...fig: no response after 5 secs - giving up I added additional debug output: ,---- | diff --git a/usr/kinit/ipconfig/main.c b/usr/kinit/ipconfig/main.c | index d501bec..8e1b62a 100644 | --- a/usr/kinit/ipconfig/main.c | +++ b/usr/kinit/ipconfig/main.c | @@ -312,7 +313,8 @@ static int do_pkt_recv(int pkt_fd, time_t now) | return ret; | | 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 =...
2009 Mar 12
1
the return value of packet_peek()
...rm 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 @@ */ ret = recvfrom(pkt_fd, &iph, sizeof(struct iphdr), MSG_PEEK, (struct sockaddr *)&sll, &sllen); + + if (ret == -1) return -1; @@ -184,6 +186,10 @@ if (iph.ihl < 5 || iph.version != IPVERSION) goto discard_pkt; + + if (iph.protocol != IPPROTO_UDP) + goto discard_pkt; + *if...
2010 Aug 24
0
[PATCH]: Exiting -1 if dhcp client failed
...diff --git a/usr/kinit/ipconfig/main.c b/usr/kinit/ipconfig/main.c index f00041b..888fdeb 100644 --- a/usr/kinit/ipconfig/main.c +++ b/usr/kinit/ipconfig/main.c -334,6 +334,7 @@ static int loop(void) int nr = 0; struct timeval now, prev; time_t start; + int return_code=0; pkt_fd = packet_open(); if (pkt_fd == -1) { -396,6 +397,7 @@ static int loop(void) now.tv_sec - start >= loop_timeout) { printf("IP-Config: no response after %d " "secs - giving up\n", loop_timeout); + re...
2010 Aug 25
0
[patch] ipconfig fixes + run-init nit
...maximilian attems <max at stro.at> diff --git a/usr/kinit/ipconfig/main.c b/usr/kinit/ipconfig/main.c index b014128..b392e6a 100644 --- a/usr/kinit/ipconfig/main.c +++ b/usr/kinit/ipconfig/main.c @@ -331,7 +331,7 @@ static int loop(void) struct pollfd fds[NR_FDS]; struct state *s; int pkt_fd; - int nr = 0; + int nr = 0, rc = 0; struct timeval now, prev; time_t start; @@ -396,6 +396,7 @@ static int loop(void) now.tv_sec - start >= loop_timeout) { printf("IP-Config: no response after %d " "secs - giving up\n", loop_timeout); + rc =...
2011 Jun 14
0
[PATCH] ipconfig: do_pkt_recv() refix ret initialisation
...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 Dec 04
0
[GIT PULL] klibc minor fixes
...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.5.25 ag...
2019 Jan 18
0
[klibc:master] ipconfig: Implement classless static routes
...,7 @@ struct netdev { char bootpath[BPLEN]; /* boot path */ char filename[FNLEN]; /* filename */ char *domainsearch; /* decoded, NULL or malloc-ed */ + struct route *routes; /* decoded, NULL or malloc-ed list */ long uptime; /* when complete configuration */ int pkt_fd; /* packet socket for this interface */ struct netdev *next; /* next configured i/f */ @@ -70,7 +79,7 @@ extern struct netdev *ifaces; int netdev_getflags(struct netdev *dev, short *flags); int netdev_setaddress(struct netdev *dev); -int netdev_setdefaultroute(struct netdev *dev); +int netd...
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