search for: sllen

Displaying 8 results from an estimated 8 matches for "sllen".

Did you mean: allen
2011 Mar 28
5
[PATCH 1/3] Only peek and discard packets from specified device.
...p packet from specified device, but doesn't remove it. * Returns: * 0 = Error * >0 = A packet of size "ret" is available for interface ifindex */ -int packet_peek(int *ifindex) +int packet_peek(struct 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: - pa...
2003 Apr 29
0
[PATCH] Fix busy-looping behaviour in ipconfig
...AL_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, + (struct sockaddr *) &sll, &sllen); +} + + /* * Receive a bootp packet. The options are...
2017 Feb 04
0
[PATCH] ipconfig: handle multiple interfaces correctly
...d, &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 packet_recv(struct netdev *dev, struct iovec *iov, int iov_len) msg.msg_name = &sll; msg.msg_namelen = sllen; - ret = recvfrom(pkt_fd, &iph, sizeof(struct iphdr), + ret = recvfrom(dev->pkt_fd, &iph, sizeof(struct iphdr), MSG_PEEK, (struc...
2019 Jan 18
0
[klibc:master] ipconfig: handle multiple interfaces correctly
...d, &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 packet_recv(struct netdev *dev, struct iovec *iov, int iov_len) msg.msg_name = &sll; msg.msg_namelen = sllen; - ret = recvfrom(pkt_fd, &iph, sizeof(struct iphdr), + ret = recvfrom(dev->pkt_fd, &iph, sizeof(struct iphdr), MSG_PEEK, (struc...
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
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
2009 Mar 12
1
the return value of packet_peek()
...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; + *ifindex = sll.sll_ifindex; @@ -191,7 +197,7 @@ discard_pkt: packet_discard(); - return 0;...
2008 Jun 14
2
PATCH: ipconfig may discard useful packets
...t;0 = A packet of size "ret" is available for interface ifindex + */ int packet_peek(int *ifindex) { struct sockaddr_ll sll; @@ -177,7 +183,7 @@ int packet_peek(int *ifindex) ret = recvfrom(pkt_fd, &iph, sizeof(struct iphdr), MSG_PEEK, (struct sockaddr *)&sll, &sllen); if (ret == -1) - return -1; + return 0; if (sll.sll_family != AF_PACKET) goto discard_pkt; @@ -187,7 +193,7 @@ int packet_peek(int *ifindex) *ifindex = sll.sll_ifindex; - return 0; + return ret; discard_pkt: packet_discard(); @@ -207,6 +213,9 @@ void packet_discard(void) /* *...