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

Diff for /src/usr.bin/nc/netcat.c between version 1.156 and 1.157

version 1.156, 2016/06/28 17:35:14 version 1.157, 2016/07/01 00:29:14
Line 1412 
Line 1412 
                         err(1, NULL);                          err(1, NULL);
         }          }
         if (Tflag != -1) {          if (Tflag != -1) {
                 int proto, option;                  if (af == AF_INET && setsockopt(s, IPPROTO_IP,
                       IP_TOS, &Tflag, sizeof(Tflag)) == -1)
                 if (af == AF_INET6) {  
                         proto = IPPROTO_IPV6;  
                         option = IPV6_TCLASS;  
                 } else {  
                         proto = IPPROTO_IP;  
                         option = IP_TOS;  
                 }  
   
                 if (setsockopt(s, proto, option, &Tflag, sizeof(Tflag)) == -1)  
                         err(1, "set IP ToS");                          err(1, "set IP ToS");
   
                   else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6,
                       IPV6_TCLASS, &Tflag, sizeof(Tflag)) == -1)
                           err(1, "set IPv6 traffic class");
         }          }
         if (Iflag) {          if (Iflag) {
                 if (setsockopt(s, SOL_SOCKET, SO_RCVBUF,                  if (setsockopt(s, SOL_SOCKET, SO_RCVBUF,
Line 1435 
Line 1430 
                     &Oflag, sizeof(Oflag)) == -1)                      &Oflag, sizeof(Oflag)) == -1)
                         err(1, "set TCP send buffer size");                          err(1, "set TCP send buffer size");
         }          }
         if (ttl != -1 || minttl != -1) {  
                 int proto, in_ttl_opt, out_ttl_opt;          if (ttl != -1) {
                 switch (af) {                  if (af == AF_INET && setsockopt(s, IPPROTO_IP,
                 case AF_INET:                      IP_TTL, &ttl, sizeof(ttl)))
                         proto = IPPROTO_IP;                          err(1, "set IP TTL");
                         in_ttl_opt = IP_MINTTL;  
                         out_ttl_opt = IP_TTL;                  else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6,
                         break;                      IPV6_UNICAST_HOPS, &ttl, sizeof(ttl)))
                 case AF_INET6:                          err(1, "set IPv6 unicast hops");
                         proto = IPPROTO_IPV6;          }
                         in_ttl_opt = IPV6_MINHOPCOUNT;  
                         out_ttl_opt = IPV6_UNICAST_HOPS;          if (minttl != -1) {
                         break;                  if (af == AF_INET && setsockopt(s, IPPROTO_IP,
                 default:                      IP_MINTTL, &minttl, sizeof(minttl)))
                         errx(1, "unknown address family: %d", af);                          err(1, "set IP min TTL");
                 }  
                 if (minttl != -1 && setsockopt(s, proto, in_ttl_opt,                  else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6,
                     &minttl, sizeof(minttl)))                      IPV6_MINHOPCOUNT, &minttl, sizeof(minttl)))
                         err(1, "setsockopt minttl");                          err(1, "set IPv6 min hop count");
                 if (ttl != -1 && setsockopt(s, proto, out_ttl_opt,  
                     &ttl, sizeof(ttl)))  
                         err(1, "setsockopt ttl");  
         }          }
 }  }
   

Legend:
Removed from v.1.156  
changed lines
  Added in v.1.157