Diff for /embedaddon/arping/src/findif_getifaddrs.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2014/06/15 16:26:43 version 1.1.1.2, 2016/10/18 13:16:10
Line 1 Line 1
 /* arping/src/findif_getifaddrs.c  /* arping/src/findif_getifaddrs.c
  *   *
 *  Copyright (C) 2000-2011 Thomas Habets <thomas@habets.se> *  Copyright (C) 2000-2014 Thomas Habets <thomas@habets.se>
  *   *
 *  This library is free software; you can redistribute it and/or *  This program is free software; you can redistribute it and/or modify
 *  modify it under the terms of the GNU General Public *  it under the terms of the GNU General Public License as published by
 *  License as published by the Free Software Foundation; either *  the Free Software Foundation; either version 2 of the License, or
 *  version 2 of the License, or (at your option) any later version. *  (at your option) any later version.
  *   *
 *  This library is distributed in the hope that it will be useful, *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  General Public License for more details. *  GNU General Public License for more details.
  *   *
  *  You should have received a copy of the GNU General Public License along   *  You should have received a copy of the GNU General Public License along
  *  with this program; if not, write to the Free Software Foundation, Inc.,   *  with this program; if not, write to the Free Software Foundation, Inc.,
Line 33 Line 33
 #include <net/if.h>  #include <net/if.h>
 #include <netinet/in.h>  #include <netinet/in.h>
   
   #if HAVE_LIBNET_H
   #include <libnet.h>
   #endif
   
 #include "arping.h"  #include "arping.h"
   
 const char *  const char *
Line 52  arping_lookupdev(uint32_t srcip, Line 56  arping_lookupdev(uint32_t srcip,
         /* Results */          /* Results */
         static char ifname[IFNAMSIZ];          static char ifname[IFNAMSIZ];
   
           *ebuf = 0;
   
         if (getifaddrs(&ifa)) {          if (getifaddrs(&ifa)) {
                 if (verbose) {                  if (verbose) {
                        printf("getifaddrs(): %s\n", strerror(errno));                        printf("arping: getifaddrs(): %s\n", strerror(errno));
                 }                  }
                   snprintf(ebuf, LIBNET_ERRBUF_SIZE,
                            "getifaddrs(): %s", strerror(errno));
                 goto out;                  goto out;
         }          }
         for (cur = ifa; cur; cur = cur->ifa_next) {          for (cur = ifa; cur; cur = cur->ifa_next) {
Line 91  arping_lookupdev(uint32_t srcip, Line 99  arping_lookupdev(uint32_t srcip,
         if (match_count) {          if (match_count) {
                 ret = ifname;                  ret = ifname;
                 if (verbose) {                  if (verbose) {
                        printf("Autodetected interface %s\n", ret);                        printf("arping: Autodetected interface %s\n", ret);
                 }                  }
         } else {          } else {
                if (verbose) {                if (verbose > 1) {
                        printf("Failed to find iface using getifaddrs().\n");                        printf("arping: Failed to find iface using"
                                " getifaddrs().\n");
                 }                  }
                   snprintf(ebuf, LIBNET_ERRBUF_SIZE,
                            "No matching interface found using getifaddrs().");
         }          }
  out:   out:
         if (ifa) {          if (ifa) {

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


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