Date: Tue, 27 Jun 2006 19:47:37 +0400 (MSD) From: "Andrey V. Elsukov" <bu7cher@yandex.ru> To: FreeBSD-gnats-submit@FreeBSD.org Cc: rwatson@FreeBSD.org, glebius@FreeBSD.org, andre@FreeBSD.org Subject: kern/99558: FreeBSD 6.1 can't send packets to INADDR_BROADCAST Message-ID: <20060627154737.EEAA615C4A@mail.heavennet.ru> Resent-Message-ID: <200606271710.k5RHALZ2001544@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 99558 >Category: kern >Synopsis: FreeBSD 6.1 can't send packets to INADDR_BROADCAST >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Jun 27 17:10:20 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Andrey V. Elsukov >Release: FreeBSD 6.1 >Organization: >Environment: FreeBSD 6.1-PRERELEASE, 6.1-STABLE have this bug FreeBSD 4.11-RELEASE, FreeBSD 5.4-STABLE, FreeBSD 5.5-RELEASE works ok. >Description: FreeBSD 6.1 can't send UDP Broadcast. Here is simple test programm: --- test.c --- #include <stdio.h> #include <err.h> #include <sys/types.h> #include <sys/socket.h> #include <arpa/inet.h> #include <netinet/in.h> #include <unistd.h> int main(void) { int sock, val, ret; struct sockaddr_in addr; sock = socket(AF_INET, SOCK_DGRAM, 0); if (sock < 0) err(1, "socket()"); addr.sin_family = AF_INET; addr.sin_port = htons(5000); addr.sin_addr.s_addr = htonl(INADDR_BROADCAST); val = 1; ret = setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (const char*)&val, sizeof(val)); if (ret < 0) err(2, "setsockopt()"); ret = sendto(sock, "test", 4, 0, (struct sockaddr*)&addr, sizeof(addr)); if (ret != 4) err(3, "sendto()"); close(sock); return (0); } --- test.c --- 1. I've connect via PPTP tunnel and my host have default route. [butcher@btr butcher]> ./test [butcher@btr butcher]> sudo tcpdump -ni ng0 -XX udp port 5000 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on ng0, link-type NULL (BSD loopback), capture size 96 bytes 19:25:32.169657 IP 192.168.3.6.53565 > 255.255.255.255.5000: UDP, length 4 0x0000: 0200 0000 4500 0020 241a 0000 4011 9305 ....E...$...@... 0x0010: c0a8 0306 ffff ffff d13d 1388 000c 6f88 .........=....o. 0x0020: 7465 7374 test ^C Message was send, but via PPTP to default destination. 2. I've not connected to PPTP server and don't have default route. [butcher@btr butcher]> netstat -rnf inet | grep default [butcher@btr butcher]> ./test test: sendto(): Network is unreachable test programm was fail with error. 3. I have the default route. [butcher@btr butcher]> sudo route add default server add net default: gateway server [butcher@btr butcher]> ./test [butcher@btr butcher]> sudo tcpdump -ni nve0 -XX udp port 5000 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on nve0, link-type EN10MB (Ethernet), capture size 96 bytes 19:29:51.988429 IP 192.168.4.234.54134 > 255.255.255.255.5000: UDP, length 4 0x0000: 0080 4836 9531 4255 5443 4821 0800 4500 ..H6.1BUTCH!..E. 0x0010: 0020 2459 0000 4011 90e2 c0a8 04ea ffff ..$Y..@......... 0x0020: ffff d376 1388 000c 6b6b 7465 7374 ...v....kktest ^C Message was send to default destination with router's destination MAC address. >How-To-Repeat: Always. >Fix: >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060627154737.EEAA615C4A>