Diff for /ansh/src/utils.c between versions 1.2 and 1.2.2.2

version 1.2, 2011/10/17 20:14:02 version 1.2.2.2, 2011/10/31 10:09:52
Line 133  PrepareL3(const struct sockaddr *sa, int *bpflen) Line 133  PrepareL3(const struct sockaddr *sa, int *bpflen)
         int h, n = 1;          int h, n = 1;
   
         FTRACE(3);          FTRACE(3);
         assert(sa);  
   
        h = socket(sa->sa_family, SOCK_RAW, IPPROTO_ICMP);        h = socket(sa ? sa->sa_family : AF_INET, SOCK_RAW, IPPROTO_ICMP);
         if (h == -1) {          if (h == -1) {
                 printf("Error:: Cant open raw socket #%d - %s\n", errno, strerror(errno));                  printf("Error:: Cant open raw socket #%d - %s\n", errno, strerror(errno));
                 return -1;                  return -1;
Line 147  PrepareL3(const struct sockaddr *sa, int *bpflen) Line 146  PrepareL3(const struct sockaddr *sa, int *bpflen)
                 return -1;                  return -1;
         }          }
         */          */
        if (bind(h, sa, sizeof(struct sockaddr)) == -1) {        if (sa && bind(h, sa, sizeof(struct sockaddr)) == -1) {
                 printf("Error:: Cant bind to raw socket #%d - %s\n", errno, strerror(errno));                  printf("Error:: Cant bind to raw socket #%d - %s\n", errno, strerror(errno));
                 close(h);                  close(h);
                 return -1;                  return -1;

Removed from v.1.2  
changed lines
  Added in v.1.2.2.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>