search for: packet_discard

Displaying 12 results from an estimated 12 matches for "packet_discard".

2011 Mar 28
5
[PATCH 1/3] Only peek and discard packets from specified device.
...alue 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 for the correct device were never processed. This patch enhance packet_peek and packet_discard to only work on packages for the specified device instead of all packets. Signed-off-by: Ulrich Dangel <uli at spamt.net> --- usr/kinit/ipconfig/bootp_proto.c | 2 +- usr/kinit/ipconfig/dhcp_proto.c | 2 +- usr/kinit/ipconfig/main.c | 16 ++++++---------- usr/kinit/ipconfig/...
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
2008 Jun 14
2
PATCH: ipconfig may discard useful packets
...'m also uploading the patch to http://users.sch.gr/alkisg/temp/0001-Signed-off-by.patch I'm sending a patch regarding the discard_packet() function, please consider it for inclusion. Signed-off-by: ????? ???????????? (alkisg at gmail.com) In main.c, function loop(), there's a call to packet_discard(). Unfortunately, there was a logic error in the return values of some functions, which caused it either to 1. Be called when a useful packet was in the queue, such as DHCPACK, and so this packet was discarded, a timeout occured and the correct address was acknowledged only by a retransmit...
2003 Apr 29
0
[PATCH] Fix busy-looping behaviour in ipconfig
...x++) { + int delta_ms; + + if (timeout_ms <= 0) + timeout_ms = 1; + + nr = poll(fds, NR_FDS, timeout_ms); + prev = now; + gettimeofday(&now, NULL); + + if ((fds[0].revents & POLLRDNORM) && + do_pkt_recv(pkt_fd, now.tv_sec) == 1) { + break; + } + packet_discard(); + + delta_ms = (now.tv_sec - prev.tv_sec) * 1000; + delta_ms += (now.tv_usec - prev.tv_usec) / 1000; + + DEBUG(("Delta: %d ms\n", delta_ms)); + + timeout_ms -= delta_ms; + } } packet_close(); @@ -365,15 +399,33 @@ int main(int argc, char *argv[]) { - int c; + int...
2009 Mar 12
1
the return value of packet_peek()
...ockaddr *)&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; + *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 (re...
2017 Feb 04
0
[PATCH] ipconfig: handle multiple interfaces correctly
...-1; } static unsigned int ip_checksum(uint16_t *hdr, int len) @@ -163,7 +170,7 @@ int packet_send(struct netdev *dev, struct iovec *iov, int iov_len) dprintf("\n bytes %d\n", len); - return sendmsg(pkt_fd, &msg, 0); + return sendmsg(dev->pkt_fd, &msg, 0); } void packet_discard(struct netdev *dev) @@ -174,7 +181,7 @@ void packet_discard(struct netdev *dev) sll.sll_ifindex = dev->ifindex; - recvfrom(pkt_fd, &iph, sizeof(iph), 0, + recvfrom(dev->pkt_fd, &iph, sizeof(iph), 0, (struct sockaddr *)&sll, &sllen); } @@ -207,7 +214,7 @@ int packe...
2019 Jan 18
0
[klibc:master] ipconfig: handle multiple interfaces correctly
...-1; } static unsigned int ip_checksum(uint16_t *hdr, int len) @@ -163,7 +170,7 @@ int packet_send(struct netdev *dev, struct iovec *iov, int iov_len) dprintf("\n bytes %d\n", len); - return sendmsg(pkt_fd, &msg, 0); + return sendmsg(dev->pkt_fd, &msg, 0); } void packet_discard(struct netdev *dev) @@ -174,7 +181,7 @@ void packet_discard(struct netdev *dev) sll.sll_ifindex = dev->ifindex; - recvfrom(pkt_fd, &iph, sizeof(iph), 0, + recvfrom(dev->pkt_fd, &iph, sizeof(iph), 0, (struct sockaddr *)&sll, &sllen); } @@ -207,7 +214,7 @@ int packe...
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
...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(); delta_ms = (now.tv_sec - prev.tv_sec) * 1000; @@ -329,7 +340,7 @@ timeout_ms -= delta_ms; } } - + bail: packet_close(); return 0; @@ -404,7 +415,7 @@ progname = argv[0]; do { - c = getopt(argc, argv, "d:np:t"); + c = getopt(argc, argv, "d:np:t:")...
2010 Aug 12
1
Bug#584583: [PATCH] Additional fix for ipconfig
[ adding relevant cc's ] On Tue, 10 Aug 2010, Julien-externe BLACHE wrote: > Hi, > > Attached is a second patch for ipconfig, which further improves (actually, > restores) ipconfig's behaviour on busy LANs with UDP noise. > > Commit 4efbcf90f60e27febe883ef052454d8cfded5c15 really is the root of all > evil, it badly broke ipconfig by doing a lot of changes all
2010 Aug 25
0
[patch] ipconfig fixes + run-init nit
...-1; + if (ret <= 0) + return ret; dprintf("\n dhcp xid %08x ", dev->bootp.xid); diff --git a/usr/kinit/ipconfig/packet.c b/usr/kinit/ipconfig/packet.c index d242457..84267b7 100644 --- a/usr/kinit/ipconfig/packet.c +++ b/usr/kinit/ipconfig/packet.c @@ -215,7 +215,8 @@ void packet_discard(void) * Receive a bootp packet. The options are listed in iov[1...iov_len]. * iov[0] must point to the bootp packet header. * Returns: - * 0 = Error, try again later + * -1 = Error, try again later +* 0 = Discarded packet (non-DHCP/BOOTP traffic) * >0 = Size of packet */ int packe...
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