summaryrefslogtreecommitdiffstats
path: root/share/man/man4/ip.4
diff options
context:
space:
mode:
authorbms <bms@FreeBSD.org>2003-08-20 14:46:40 +0000
committerbms <bms@FreeBSD.org>2003-08-20 14:46:40 +0000
commit3af3c5ae44ef98b9f2da135dcb64cfc12acd0f39 (patch)
treeb0740a95462efb0df015bc34d5d05f5d96cd2f3b /share/man/man4/ip.4
parent5546ba50272e71097a2f7c6b9fbec902cf58c4ea (diff)
downloadFreeBSD-src-3af3c5ae44ef98b9f2da135dcb64cfc12acd0f39.zip
FreeBSD-src-3af3c5ae44ef98b9f2da135dcb64cfc12acd0f39.tar.gz
Add the IP_ONESBCAST option, to enable undirected IP broadcasts to be sent on
specific interfaces. This is required by aodvd, and may in future help us in getting rid of the requirement for BPF from our import of isc-dhcp. Suggested by: fenestro Obtained from: BSD/OS Reviewed by: mini, sam Approved by: jake (mentor)
Diffstat (limited to 'share/man/man4/ip.4')
-rw-r--r--share/man/man4/ip.441
1 files changed, 41 insertions, 0 deletions
diff --git a/share/man/man4/ip.4 b/share/man/man4/ip.4
index d7453da..0203039 100644
--- a/share/man/man4/ip.4
+++ b/share/man/man4/ip.4
@@ -175,6 +175,47 @@ can be used directly as a control message for
.Xr sendmsg 2 .
.Pp
If the
+.Dv IP_ONESBCAST
+option is enabled on a
+.Dv SOCK_DGRAM
+or a
+.Dv SOCK_RAW
+socket, the destination address of outgoing
+broadcast datagrams on that socket will be forced
+to the undirected broadcast address,
+.Dv INADDR_BROADCAST ,
+before transmission.
+This is in contrast to the default behavior of the
+system, which is to transmit undirected broadcasts
+via the first network interface with the
+.Dv IFF_BROADCAST flag set.
+.Pp
+This option allows applications to choose which
+interface is used to transmit an undirected broadcast
+datagram.
+For example, the following code would force an
+undirected broadcast to be transmitted via the interface
+configured with the broadcast address 192.168.2.255:
+.Bd -literal
+char msg[512];
+struct sockaddr_in sin;
+u_char onesbcast = 1; /* 0 = disable (default), 1 = enable */
+
+setsockopt(s, IPPROTO_IP, IP_ONESBCAST, &onesbcast, sizeof(onesbcast));
+sin.sin_addr.s_addr = inet_addr("192.168.2.255");
+sin.sin_port = htons(1234);
+sendto(s, msg, sizeof(msg), 0, &sin, sizeof(sin));
+.Ed
+.Pp
+It is the application's responsibility to set the
+.Dv IP_TTL option
+to an appropriate value in order to prevent broadcast storms.
+The application must have sufficient credentials to set the
+.Dv SO_BROADCAST
+socket level option, otherwise the
+.Dv IP_ONESBCAST option has no effect.
+.Pp
+If the
.Dv IP_RECVTTL
option is enabled on a
.Dv SOCK_DGRAM
OpenPOWER on IntegriCloud