diff options
author | Guy Harris <guy@alum.mit.edu> | 2004-07-18 23:07:04 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2004-07-18 23:07:04 +0000 |
commit | 5e6004745b417f0530075c76131b38a718ead21d (patch) | |
tree | cf57eac52d306a23e846afbefc1f2e332c6f59fc /pcap-util.c | |
parent | 56c759212fe2e177d10580bb77376e468420c5ee (diff) | |
download | wireshark-5e6004745b417f0530075c76131b38a718ead21d.tar.gz wireshark-5e6004745b417f0530075c76131b38a718ead21d.tar.bz2 wireshark-5e6004745b417f0530075c76131b38a718ead21d.zip |
"struct sockaddr_in"s and "struct sockaddr_in6"s are sufficient to serve
as transport endpoint addresses, so the "sa_data" field includes port
numbers. Revert the IPv4 code; we'll fix the IPv6 code later (we'll
have to check whether "struct sockaddr_in6" is defined, and not support
IPv6 addresses if it's not, even if AF_INET6 is defined).
svn path=/trunk/; revision=11420
Diffstat (limited to 'pcap-util.c')
-rw-r--r-- | pcap-util.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pcap-util.c b/pcap-util.c index 6f3a7e6fe2..2f3e80e6cd 100644 --- a/pcap-util.c +++ b/pcap-util.c @@ -198,14 +198,16 @@ void if_info_add_address(if_info_t *if_info, struct sockaddr *addr) { if_addr_t *ip_addr; + struct sockaddr_in *ai; switch (addr->sa_family) { case AF_INET: + ai = (struct sockaddr_in *)addr; ip_addr = g_malloc(sizeof(*ip_addr)); ip_addr->family = FAM_IPv4; - memcpy((void *)&ip_addr->ip_addr.ip4_addr, - (void *)&addr->sa_data, 4); + ip_addr->ip_addr.ip4_addr = + *((guint32 *)&(ai->sin_addr.s_addr)); if_info->ip_addr = g_slist_append(if_info->ip_addr, ip_addr); break; |