Bugzilla – Attachment 1994 Details for
Bug 1855
set traffic class on IPv6 packets
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
set IPV6_TCLASS for IPv6 connections
openssh_set_ipv6_traffic_class.patch (text/plain), 1.75 KB, created by
Colin Watson
on 2011-02-09 01:53:21 AEDT
(
hide
)
Description:
set IPV6_TCLASS for IPv6 connections
Filename:
MIME Type:
Creator:
Colin Watson
Created:
2011-02-09 01:53:21 AEDT
Size:
1.75 KB
patch
obsolete
>=== modified file 'packet.c' >--- packet.c 2010-11-23 23:46:37 +0000 >+++ packet.c 2011-02-08 14:48:37 +0000 >@@ -444,6 +444,28 @@ packet_connection_is_ipv4(void) > return 0; > } > >+/* returns 1 if connection is via ipv6 */ >+ >+int >+packet_connection_is_ipv6(void) >+{ >+ struct sockaddr_storage to; >+ socklen_t tolen = sizeof(to); >+ >+ memset(&to, 0, sizeof(to)); >+ if (getsockname(active_state->connection_out, (struct sockaddr *)&to, >+ &tolen) < 0) >+ return 0; >+#ifdef IPV4_IN_IPV6 >+ if (to.ss_family == AF_INET6 && >+ IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)&to)->sin6_addr)) >+ return 0; >+#endif >+ if (to.ss_family == AF_INET6) >+ return 1; >+ return 0; >+} >+ > /* Sets the connection into non-blocking mode. */ > > void >@@ -1753,14 +1775,24 @@ static void > packet_set_tos(int tos) > { > #if defined(IP_TOS) && !defined(IP_TOS_IS_BROKEN) >- if (!packet_connection_is_on_socket() || >- !packet_connection_is_ipv4()) >+ if (!packet_connection_is_on_socket()) > return; >- debug3("%s: set IP_TOS 0x%02x", __func__, tos); >- if (setsockopt(active_state->connection_in, IPPROTO_IP, IP_TOS, &tos, >- sizeof(tos)) < 0) >- error("setsockopt IP_TOS %d: %.100s:", >- tos, strerror(errno)); >+ if (packet_connection_is_ipv4()) { >+ debug3("%s: set IP_TOS 0x%02x", __func__, tos); >+ if (setsockopt(active_state->connection_in, IPPROTO_IP, >+ IP_TOS, &tos, sizeof(tos)) < 0) >+ error("setsockopt IP_TOS %d: %.100s:", >+ tos, strerror(errno)); >+ } >+# ifdef IPV6_TCLASS >+ else if (packet_connection_is_ipv6()) { >+ debug3("%s: set IPV6_TCLASS 0x%02x", __func__, tos); >+ if (setsockopt(active_state->connection_in, IPPROTO_IPV6, >+ IPV6_TCLASS, &tos, sizeof(tos)) < 0) >+ error("setsockopt IPV6_TCLASS %d: %.100s:", >+ tos, strerror(errno)); >+ } >+# endif > #endif > } > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1855
: 1994