equal
deleted
inserted
replaced
1315 * 1. IPv6 on Solaris/Mac OS: NOOP and will be set |
1315 * 1. IPv6 on Solaris/Mac OS: NOOP and will be set |
1316 * in flowinfo field when connecting TCP socket, |
1316 * in flowinfo field when connecting TCP socket, |
1317 * or sending UDP packet. |
1317 * or sending UDP packet. |
1318 * 2. IPv6 on Linux: By default Linux ignores flowinfo |
1318 * 2. IPv6 on Linux: By default Linux ignores flowinfo |
1319 * field so enable IPV6_FLOWINFO_SEND so that flowinfo |
1319 * field so enable IPV6_FLOWINFO_SEND so that flowinfo |
1320 * will be examined. |
1320 * will be examined. We also set the IPv4 TOS option in this case. |
1321 * 3. IPv4: set socket option based on ToS and Precedence |
1321 * 3. IPv4: set socket option based on ToS and Precedence |
1322 * fields (otherwise get invalid argument) |
1322 * fields (otherwise get invalid argument) |
1323 */ |
1323 */ |
1324 if (level == IPPROTO_IP && opt == IP_TOS) { |
1324 if (level == IPPROTO_IP && opt == IP_TOS) { |
1325 int *iptos; |
1325 int *iptos; |
1331 #endif |
1331 #endif |
1332 |
1332 |
1333 #if defined(AF_INET6) && defined(__linux__) |
1333 #if defined(AF_INET6) && defined(__linux__) |
1334 if (ipv6_available()) { |
1334 if (ipv6_available()) { |
1335 int optval = 1; |
1335 int optval = 1; |
1336 return setsockopt(fd, IPPROTO_IPV6, IPV6_FLOWINFO_SEND, |
1336 if (setsockopt(fd, IPPROTO_IPV6, IPV6_FLOWINFO_SEND, |
1337 (void *)&optval, sizeof(optval)); |
1337 (void *)&optval, sizeof(optval)) < 0) { |
|
1338 return -1; |
|
1339 } |
1338 } |
1340 } |
1339 #endif |
1341 #endif |
1340 |
1342 |
1341 iptos = (int *)arg; |
1343 iptos = (int *)arg; |
1342 *iptos &= (IPTOS_TOS_MASK | IPTOS_PREC_MASK); |
1344 *iptos &= (IPTOS_TOS_MASK | IPTOS_PREC_MASK); |