search for: discard_pkt

Displaying 6 results from an estimated 6 matches for "discard_pkt".

2009 Mar 12
1
the return value of packet_peek()
...9-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; + *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_...
2011 Mar 28
5
[PATCH 1/3] Only peek and discard packets from specified device.
...ct netdev *dev) { struct sockaddr_ll sll; struct iphdr iph; int ret, sllen = sizeof(struct sockaddr_ll); + sll.sll_ifindex = dev->ifindex; /* * Peek at the IP header. */ @@ -192,21 +193,22 @@ int packet_peek(int *ifindex) if (iph.ihl < 5 || iph.version != IPVERSION) goto discard_pkt; - *ifindex = sll.sll_ifindex; return ret; discard_pkt: - packet_discard(); + packet_discard(dev); return 0; } -void packet_discard(void) +void packet_discard(struct netdev *dev) { struct iphdr iph; struct sockaddr_ll sll; socklen_t sllen = sizeof(sll); + sll.sll_ifindex = de...
2008 Jun 14
2
PATCH: ipconfig may discard useful packets
...(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 the NIC to wait until it happens to receive some packet. Kind regards, Alkis Georgopoulos --- usr/kinit/ipconfig/bootp_proto.c |...
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
2003 Apr 29
0
[PATCH] Fix busy-looping behaviour in ipconfig
....len = 0, .check = 0, }, @@ -108,6 +112,11 @@ }; int i, len = 0; + if (local_port != LOCAL_PORT) { + ipudp_hdrs.udp.source = htons(local_port); + ipudp_hdrs.udp.dest = htons(remote_port); + } + /* * Glue in the ip+udp header iovec */ @@ -160,11 +169,21 @@ return 0; discard_pkt: - recvfrom(pkt_fd, &iph, sizeof(struct iphdr), - 0, (struct sockaddr *)&sll, &sllen); + packet_discard(); return 0; } +void packet_discard(void) +{ + struct iphdr iph; + struct sockaddr_ll sll; + socklen_t sllen = sizeof(sll); + + recvfrom(pkt_fd, &iph, sizeof(iph), 0, +...
2010 Aug 25
0
[patch] ipconfig fixes + run-init nit
..._recv(struct iovec *iov, int iov_len) @@ -236,7 +237,7 @@ int packet_recv(struct iovec *iov, int iov_len) ret = recvfrom(pkt_fd, &iph, sizeof(struct iphdr), MSG_PEEK, NULL, NULL); if (ret == -1) - return 0; + return -1; if (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,...