[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.155 and 1.156

version 1.155, 2016/06/28 00:01:10 version 1.156, 2016/06/28 17:35:14
Line 115 
Line 115 
 int family = AF_UNSPEC;  int family = AF_UNSPEC;
 char *portlist[PORT_MAX+1];  char *portlist[PORT_MAX+1];
 char *unix_dg_tmp_socket;  char *unix_dg_tmp_socket;
   int ttl = -1;
   int minttl = -1;
   
 void    atelnet(int, unsigned char *, unsigned int);  void    atelnet(int, unsigned char *, unsigned int);
 void    build_ports(char *);  void    build_ports(char *);
Line 166 
Line 168 
         signal(SIGPIPE, SIG_IGN);          signal(SIGPIPE, SIG_IGN);
   
         while ((ch = getopt(argc, argv,          while ((ch = getopt(argc, argv,
             "46C:cDde:FH:hI:i:K:klNnO:P:p:R:rSs:T:tUuV:vw:X:x:z")) != -1) {              "46C:cDde:FH:hI:i:K:klM:m:NnO:P:p:R:rSs:T:tUuV:vw:X:x:z")) != -1) {
                 switch (ch) {                  switch (ch) {
                 case '4':                  case '4':
                         family = AF_INET;                          family = AF_INET;
Line 222 
Line 224 
                 case 'l':                  case 'l':
                         lflag = 1;                          lflag = 1;
                         break;                          break;
                   case 'M':
                           ttl = strtonum(optarg, 0, 255, &errstr);
                           if (errstr)
                                   errx(1, "ttl is %s", errstr);
                           break;
                   case 'm':
                           minttl = strtonum(optarg, 0, 255, &errstr);
                           if (errstr)
                                   errx(1, "minttl is %s", errstr);
                           break;
                 case 'N':                  case 'N':
                         Nflag = 1;                          Nflag = 1;
                         break;                          break;
Line 1423 
Line 1435 
                     &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;
                   switch (af) {
                   case AF_INET:
                           proto = IPPROTO_IP;
                           in_ttl_opt = IP_MINTTL;
                           out_ttl_opt = IP_TTL;
                           break;
                   case AF_INET6:
                           proto = IPPROTO_IPV6;
                           in_ttl_opt = IPV6_MINHOPCOUNT;
                           out_ttl_opt = IPV6_UNICAST_HOPS;
                           break;
                   default:
                           errx(1, "unknown address family: %d", af);
                   }
                   if (minttl != -1 && setsockopt(s, proto, in_ttl_opt,
                       &minttl, sizeof(minttl)))
                           err(1, "setsockopt minttl");
                   if (ttl != -1 && setsockopt(s, proto, out_ttl_opt,
                       &ttl, sizeof(ttl)))
                           err(1, "setsockopt ttl");
           }
 }  }
   
 int  int
Line 1570 
Line 1605 
         \t-K keyfile    Private key file\n\          \t-K keyfile    Private key file\n\
         \t-k            Keep inbound sockets open for multiple connects\n\          \t-k            Keep inbound sockets open for multiple connects\n\
         \t-l            Listen mode, for inbound connects\n\          \t-l            Listen mode, for inbound connects\n\
           \t-M ttl                Outgoing TTL / Hop Limit\n\
           \t-m minttl     Minimum incoming TTL / Hop Limit\n\
         \t-N            Shutdown the network socket after EOF on stdin\n\          \t-N            Shutdown the network socket after EOF on stdin\n\
         \t-n            Suppress name/port resolutions\n\          \t-n            Suppress name/port resolutions\n\
         \t-O length     TCP send buffer length\n\          \t-O length     TCP send buffer length\n\
Line 1599 
Line 1636 
         fprintf(stderr,          fprintf(stderr,
             "usage: nc [-46cDdFhklNnrStUuvz] [-C certfile] [-e name] "              "usage: nc [-46cDdFhklNnrStUuvz] [-C certfile] [-e name] "
             "[-H hash] [-I length]\n"              "[-H hash] [-I length]\n"
             "\t  [-i interval] [-K keyfile] [-O length] [-P proxy_username]\n"              "\t  [-i interval] [-K keyfile] [-M ttl] [-m minttl] [-O length]\n"
             "\t  [-p source_port] [-R CAfile] [-s source] "              "\t  [-P proxy_username] [-p source_port] [-R CAfile] [-s source]\n"
             "[-T keyword] [-V rtable]\n"              "\t  [-T keyword] [-V rtable] [-w timeout] [-X proxy_protocol]\n"
             "\t  [-w timeout] [-X proxy_protocol] [-x proxy_address[:port]]\n"              "\t  [-x proxy_address[:port]] [destination] [port]\n");
             "\t  [destination] [port]\n");  
         if (ret)          if (ret)
                 exit(1);                  exit(1);
 }  }

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