summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorBruce M Simpson <bms@FreeBSD.org>2003-08-20 14:46:40 +0000
committerBruce M Simpson <bms@FreeBSD.org>2003-08-20 14:46:40 +0000
commit8afa23047014b6c73e856501c7dc4deb6caf899f (patch)
treeb0740a95462efb0df015bc34d5d05f5d96cd2f3b /share
parent2d81cd746bc13dfd4f42652bf1060ab0b44908e8 (diff)
Notes
Diffstat (limited to 'share')
-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 d7453da21b87d..02030393e68e1 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