[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.11 and 1.12

version 1.11, 2000/09/26 01:15:49 version 1.12, 2000/09/26 02:51:22
Line 511 
Line 511 
         x = 1;          x = 1;
         rr = setsockopt(nnetfd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x));          rr = setsockopt(nnetfd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x));
         if (rr == -1)          if (rr == -1)
                 warn("nnetfd reuseaddr failed");        /* ??? */                  errx(1, NULL);
   
         /* fill in all the right sockaddr crud */          /* fill in all the right sockaddr crud */
         lclend->sin_family = AF_INET;          lclend->sin_family = AF_INET;
Line 620 
Line 620 
                         strcat(bigbuf_net, "any");                          strcat(bigbuf_net, "any");
                 strcat(bigbuf_net, "] %d ...");                  strcat(bigbuf_net, "] %d ...");
                 z = ntohs(lclend->sin_port);                  z = ntohs(lclend->sin_port);
                 warn(bigbuf_net, z);                  warn("%s %d", bigbuf_net, z);
         }                       /* verbose -- whew!! */          }                       /* verbose -- whew!! */
         /*          /*
          * UDP is a speeeeecial case -- we have to do I/O *and* get the           * UDP is a speeeeecial case -- we have to do I/O *and* get the
Line 670 
Line 670 
         cp = &bigbuf_net[32];          cp = &bigbuf_net[32];
         x = sizeof(struct sockaddr);          x = sizeof(struct sockaddr);
         rr = getsockname(nnetfd, (struct sockaddr *) lclend, &x);          rr = getsockname(nnetfd, (struct sockaddr *) lclend, &x);
         if (rr < 0)          if (rr < 0 && o_verbose)
                 warn("post-rcv getsockname failed");                  warn("post-rcv getsockname failed");
         strcpy(cp, inet_ntoa(lclend->sin_addr));          strcpy(cp, inet_ntoa(lclend->sin_addr));
   
Line 691 
Line 691 
                 errx(1, "invalid connection to [%s] from %s [%s] %d",                  errx(1, "invalid connection to [%s] from %s [%s] %d",
                     cp, whozis->name, whozis->addrs[0], z);                      cp, whozis->name, whozis->addrs[0], z);
         }          }
         warn("connect to [%s] from %s [%s] %d",          if (o_verbose) {
             cp, whozis->name, whozis->addrs[0], z);                  warn("connect to [%s] from %s [%s] %d",
                           cp, whozis->name, whozis->addrs[0], z);
           }
         return (nnetfd);          return (nnetfd);
   
 dol_tmo:  dol_tmo:
Line 721 
Line 723 
         int rr;          int rr;
   
         rr = write(fd, bigbuf_in, 1);          rr = write(fd, bigbuf_in, 1);
         if (rr != 1)          if (rr != 1 && o_verbose)
                 warn("udptest first write failed?! errno %d", errno);                  warn("udptest first write failed?! errno %d", errno);
         if (o_wait)          if (o_wait)
                 sleep(o_wait);                  sleep(o_wait);
Line 966 
Line 968 
                                 netretry--;     /* we actually try a coupla                                  netretry--;     /* we actually try a coupla
                                                  * times. */                                                   * times. */
                         if (!netretry) {                          if (!netretry) {
                                 if (o_verbose > 1)      /* normally we don't                                  if (o_verbose)  /* normally we don't
                                                          * care */                                                           * care */
                                         warn("net timeout");                                          warn("net timeout");
                                 close(fd);                                  close(fd);
Line 1018 
Line 1020 
 shovel:  shovel:
                 /* sanity check.  Works because they're both unsigned... */                  /* sanity check.  Works because they're both unsigned... */
                 if ((rzleft > 8200) || (rnleft > 8200)) {                  if ((rzleft > 8200) || (rnleft > 8200)) {
                         warn("Bogus buffers: %d, %d", rzleft, rnleft);  
                         rzleft = rnleft = 0;                          rzleft = rnleft = 0;
                 }                  }
                 /* net write retries sometimes happen on UDP connections */                  /* net write retries sometimes happen on UDP connections */
Line 1279 
Line 1280 
                 netfd = dolisten(themaddr, curport, ouraddr, o_lport);                  netfd = dolisten(themaddr, curport, ouraddr, o_lport);
                 if (netfd > 0) {                  if (netfd > 0) {
                         x = readwrite(netfd);                          x = readwrite(netfd);
                         if (o_verbose > 1)                          if (o_verbose)
                                 warn("Sent %i Rcvd %i", wrote_net, wrote_out);                                  warn("Sent %i Rcvd %i", wrote_net, wrote_out);
                         exit(x);                          exit(x);
                 } else                  } else

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12