[BACK]Return to packet.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/packet.c between version 1.172 and 1.173

version 1.172, 2010/11/13 23:27:50 version 1.173, 2011/05/06 21:14:05
Line 418 
Line 418 
         state->bytes = bytes;          state->bytes = bytes;
 }  }
   
 /* returns 1 if connection is via ipv4 */  static int
   packet_connection_af(void)
 int  
 packet_connection_is_ipv4(void)  
 {  {
         struct sockaddr_storage to;          struct sockaddr_storage to;
         socklen_t tolen = sizeof(to);          socklen_t tolen = sizeof(to);
Line 430 
Line 428 
         if (getsockname(active_state->connection_out, (struct sockaddr *)&to,          if (getsockname(active_state->connection_out, (struct sockaddr *)&to,
             &tolen) < 0)              &tolen) < 0)
                 return 0;                  return 0;
         if (to.ss_family != AF_INET)          return to.ss_family;
                 return 0;  
         return 1;  
 }  }
   
 /* Sets the connection into non-blocking mode. */  /* Sets the connection into non-blocking mode. */
Line 1736 
Line 1732 
 static void  static void
 packet_set_tos(int tos)  packet_set_tos(int tos)
 {  {
         if (!packet_connection_is_on_socket() ||          if (!packet_connection_is_on_socket())
             !packet_connection_is_ipv4())  
                 return;                  return;
         debug3("%s: set IP_TOS 0x%02x", __func__, tos);          switch (packet_connection_af()) {
         if (setsockopt(active_state->connection_in, IPPROTO_IP, IP_TOS, &tos,          case AF_INET:
             sizeof(tos)) < 0)                  debug3("%s: set IP_TOS 0x%02x", __func__, tos);
                 error("setsockopt IP_TOS %d: %.100s:",                  if (setsockopt(active_state->connection_in,
                     tos, strerror(errno));                      IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) < 0)
                           error("setsockopt IP_TOS %d: %.100s:",
                               tos, strerror(errno));
                   break;
           case AF_INET6:
                   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));
                   break;
           }
 }  }
   
 /* Informs that the current session is interactive.  Sets IP flags for that. */  /* Informs that the current session is interactive.  Sets IP flags for that. */

Legend:
Removed from v.1.172  
changed lines
  Added in v.1.173