| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | .\" $NetBSD: ip.4,v 1.29 2009/07/19 23:17:33 minskim Exp $ | | 1 | .\" $NetBSD: ip.4,v 1.30 2009/07/20 07:58:54 wiz Exp $ |
2 | .\" | | 2 | .\" |
3 | .\" Copyright (c) 1983, 1991, 1993 | | 3 | .\" Copyright (c) 1983, 1991, 1993 |
4 | .\" The Regents of the University of California. All rights reserved. | | 4 | .\" The Regents of the University of California. All rights reserved. |
5 | .\" | | 5 | .\" |
6 | .\" Redistribution and use in source and binary forms, with or without | | 6 | .\" Redistribution and use in source and binary forms, with or without |
7 | .\" modification, are permitted provided that the following conditions | | 7 | .\" modification, are permitted provided that the following conditions |
8 | .\" are met: | | 8 | .\" are met: |
9 | .\" 1. Redistributions of source code must retain the above copyright | | 9 | .\" 1. Redistributions of source code must retain the above copyright |
10 | .\" notice, this list of conditions and the following disclaimer. | | 10 | .\" notice, this list of conditions and the following disclaimer. |
11 | .\" 2. Redistributions in binary form must reproduce the above copyright | | 11 | .\" 2. Redistributions in binary form must reproduce the above copyright |
12 | .\" notice, this list of conditions and the following disclaimer in the | | 12 | .\" notice, this list of conditions and the following disclaimer in the |
13 | .\" documentation and/or other materials provided with the distribution. | | 13 | .\" documentation and/or other materials provided with the distribution. |
14 | .\" 3. Neither the name of the University nor the names of its contributors | | 14 | .\" 3. Neither the name of the University nor the names of its contributors |
| @@ -180,27 +180,29 @@ The msg_control field in the msghdr stru | | | @@ -180,27 +180,29 @@ The msg_control field in the msghdr stru |
180 | that contains a cmsghdr structure followed by the | | 180 | that contains a cmsghdr structure followed by the |
181 | .Tn TTL | | 181 | .Tn TTL |
182 | value. | | 182 | value. |
183 | The cmsghdr fields have the following values: | | 183 | The cmsghdr fields have the following values: |
184 | .Bd -literal | | 184 | .Bd -literal |
185 | cmsg_len = sizeof(uint8_t) | | 185 | cmsg_len = sizeof(uint8_t) |
186 | cmsg_level = IPPROTO_IP | | 186 | cmsg_level = IPPROTO_IP |
187 | cmsg_type = IP_RECVTTL | | 187 | cmsg_type = IP_RECVTTL |
188 | .Ed | | 188 | .Ed |
189 | .Pp | | 189 | .Pp |
190 | The | | 190 | The |
191 | .Dv IP_MINTTL | | 191 | .Dv IP_MINTTL |
192 | option may be used on | | 192 | option may be used on |
193 | .Dv SOCK_DGRAM or SOCK_STREAM | | 193 | .Dv SOCK_DGRAM |
| | | 194 | or |
| | | 195 | .Dv SOCK_STREAM |
194 | sockets to discard packets with a TTL lower than the option value. | | 196 | sockets to discard packets with a TTL lower than the option value. |
195 | This can be used to implement the | | 197 | This can be used to implement the |
196 | .Em Generalized TTL Security Mechanism (GTSM) | | 198 | .Em Generalized TTL Security Mechanism (GTSM) |
197 | according to RFC 3682. | | 199 | according to RFC 3682. |
198 | To discard all packets with a TTL lower than 255: | | 200 | To discard all packets with a TTL lower than 255: |
199 | .Bd -literal -offset indent | | 201 | .Bd -literal -offset indent |
200 | int minttl = 255; | | 202 | int minttl = 255; |
201 | setsockopt(s, IPPROTO_IP, IP_MINTTL, \*[Am]minttl, sizeof(minttl)); | | 203 | setsockopt(s, IPPROTO_IP, IP_MINTTL, \*[Am]minttl, sizeof(minttl)); |
202 | .Ed | | 204 | .Ed |
203 | .Ss MULTICAST OPTIONS | | 205 | .Ss MULTICAST OPTIONS |
204 | .Tn IP | | 206 | .Tn IP |
205 | multicasting is supported only on | | 207 | multicasting is supported only on |
206 | .Dv AF_INET | | 208 | .Dv AF_INET |