"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "addrtoname.c" between
tcpdump-4.99.0.tar.gz and tcpdump-4.99.1.tar.gz

About: tcpdump is a tool for network monitoring and data acquisition.

addrtoname.c  (tcpdump-4.99.0):addrtoname.c  (tcpdump-4.99.1)
skipping to change at line 80 skipping to change at line 80
#else #else
/* /*
* We'll have to declare it ourselves. * We'll have to declare it ourselves.
* If <netinet/if_ether.h> defines struct ether_addr, include * If <netinet/if_ether.h> defines struct ether_addr, include
* it. Otherwise, define it ourselves. * it. Otherwise, define it ourselves.
*/ */
#ifdef HAVE_STRUCT_ETHER_ADDR #ifdef HAVE_STRUCT_ETHER_ADDR
#define NEED_NETINET_IF_ETHER_H #define NEED_NETINET_IF_ETHER_H
#else /* HAVE_STRUCT_ETHER_ADDR */ #else /* HAVE_STRUCT_ETHER_ADDR */
struct ether_addr { struct ether_addr {
/* Beware FreeBSD calls this "octet". */
unsigned char ether_addr_octet[MAC_ADDR_LEN]; unsigned char ether_addr_octet[MAC_ADDR_LEN];
}; };
#endif /* HAVE_STRUCT_ETHER_ADDR */ #endif /* HAVE_STRUCT_ETHER_ADDR */
#endif /* what declares ether_ntohost() */ #endif /* what declares ether_ntohost() */
#ifdef NEED_NETINET_IF_ETHER_H #ifdef NEED_NETINET_IF_ETHER_H
#include <net/if.h> /* Needed on some platforms */ #include <net/if.h> /* Needed on some platforms */
#include <netinet/in.h> /* Needed on some platforms */ #include <netinet/in.h> /* Needed on some platforms */
#include <netinet/if_ether.h> #include <netinet/if_ether.h>
#endif /* NEED_NETINET_IF_ETHER_H */ #endif /* NEED_NETINET_IF_ETHER_H */
skipping to change at line 604 skipping to change at line 605
struct enamemem *tp; struct enamemem *tp;
int oui; int oui;
char buf[BUFSIZE]; char buf[BUFSIZE];
tp = lookup_emem(ndo, ep); tp = lookup_emem(ndo, ep);
if (tp->e_name) if (tp->e_name)
return (tp->e_name); return (tp->e_name);
#ifdef USE_ETHER_NTOHOST #ifdef USE_ETHER_NTOHOST
if (!ndo->ndo_nflag) { if (!ndo->ndo_nflag) {
char buf2[BUFSIZE]; char buf2[BUFSIZE];
/*
* This is a non-const copy of ep for ether_ntohost(), which
* has its second argument non-const in OpenBSD. Also saves a
* type cast.
*/
struct ether_addr ea;
if (ether_ntohost(buf2, (const struct ether_addr *)ep) == 0) { memcpy (&ea, ep, MAC_ADDR_LEN);
if (ether_ntohost(buf2, &ea) == 0) {
tp->e_name = strdup(buf2); tp->e_name = strdup(buf2);
if (tp->e_name == NULL) if (tp->e_name == NULL)
(*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC, (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
"%s: strdup(buf2)", __func__); "%s: strdup(buf2)", __func__);
return (tp->e_name); return (tp->e_name);
} }
} }
#endif #endif
cp = buf; cp = buf;
oui = EXTRACT_BE_U_3(ep); oui = EXTRACT_BE_U_3(ep);
skipping to change at line 980 skipping to change at line 988
for (el = etherlist; el->name != NULL; ++el) { for (el = etherlist; el->name != NULL; ++el) {
tp = lookup_emem(ndo, el->addr); tp = lookup_emem(ndo, el->addr);
/* Don't override existing name */ /* Don't override existing name */
if (tp->e_name != NULL) if (tp->e_name != NULL)
continue; continue;
#ifdef USE_ETHER_NTOHOST #ifdef USE_ETHER_NTOHOST
/* /*
* Use YP/NIS version of name if available. * Use YP/NIS version of name if available.
*/ */
if (ether_ntohost(name, (const struct ether_addr *)el->addr) == 0 /* Same workaround as in etheraddr_string(). */
) { struct ether_addr ea;
memcpy (&ea, el->addr, MAC_ADDR_LEN);
if (ether_ntohost(name, &ea) == 0) {
tp->e_name = strdup(name); tp->e_name = strdup(name);
if (tp->e_name == NULL) if (tp->e_name == NULL)
(*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC, (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
"%s: strdup(name)", __func__); "%s: strdup(name)", __func__);
continue; continue;
} }
#endif #endif
tp->e_name = el->name; tp->e_name = el->name;
} }
} }
 End of changes. 4 change blocks. 
3 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)