summaryrefslogtreecommitdiff
path: root/com32/hdt
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2011-04-25 17:15:40 -0700
committerH. Peter Anvin <hpa@zytor.com>2011-04-25 17:15:40 -0700
commit0c8bfd91ab11a00b796f32982a30414c8bac7ec9 (patch)
tree5142bd9cdf882aa2e6bbbbabafb0a3f6d6a54da1 /com32/hdt
parent842d7e35ccd8cd89105faf0266497e838d96c8b3 (diff)
downloadsyslinux-0c8bfd91ab11a00b796f32982a30414c8bac7ec9.tar.gz
com32: inet_ntoa() takes struct in_addr
The standard definition for inet_ntoa() is to take struct in_addr, and not doing that causes a conflict on the lwip branch. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'com32/hdt')
-rw-r--r--com32/hdt/hdt-dump-pxe.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/com32/hdt/hdt-dump-pxe.c b/com32/hdt/hdt-dump-pxe.c
index 6f4f511a..4e25c943 100644
--- a/com32/hdt/hdt-dump-pxe.c
+++ b/com32/hdt/hdt-dump-pxe.c
@@ -32,6 +32,7 @@
#include <netinet/in.h>
void dump_pxe(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item) {
+ struct in_addr in;
CREATE_NEW_OBJECT;
add_hb(is_pxe_valid);
@@ -64,16 +65,14 @@ void dump_pxe(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item)
add_hi(pxe.nictype);
add_hs(pxe.mac_addr);
- char ip[16] = {0};
- snprintf(ip,sizeof(ip), "%d.%d.%d.%d",
- hardware->pxe.ip_addr[0],
- hardware->pxe.ip_addr[1],
- hardware->pxe.ip_addr[2],
- hardware->pxe.ip_addr[3]);
- add_s("pxe.client_ip",inet_ntoa(hardware->pxe.dhcpdata.cip));
- add_s("pxe.next_server_ip",inet_ntoa(hardware->pxe.dhcpdata.sip));
- add_s("pxe.relay_agent_ip",inet_ntoa(hardware->pxe.dhcpdata.gip));
- add_s("pxe.ipaddr",ip);
+ in.s_addr = hardware->pxe.dhcpdata.cip;
+ add_s("pxe.client_ip", inet_ntoa(in));
+ in.s_addr = hardware->pxe.dhcpdata.sip;
+ add_s("pxe.next_server_ip",inet_ntoa(in));
+ in.s_addr = hardware->pxe.dhcpdata.gip;
+ add_s("pxe.relay_agent_ip",inet_ntoa(in));
+ memcpy(&in, hardware->pxe.ip_addr, sizeof in);
+ add_s("pxe.ipaddr",inet_ntoa(in));
add_b("gpxe_detected",is_gpxe());
}
FLUSH_OBJECT;