diff --git a/src/core/inet.c b/src/core/inet.c index 818f7ba9..694cb002 100644 --- a/src/core/inet.c +++ b/src/core/inet.c @@ -300,9 +300,10 @@ inet_chksum_pbuf(struct pbuf *p) /* Convert numeric IP address into decimal dotted ASCII representation. * returns ptr to static buffer; not reentrant! */ -u8_t *inet_ntoa(u32_t addr) +char *inet_ntoa(struct in_addr addr) { static u8_t str[16]; + u32_t s_addr = addr.s_addr; u8_t inv[3]; u8_t *rp; u8_t *ap; @@ -311,7 +312,7 @@ u8_t *inet_ntoa(u32_t addr) u8_t i; rp = str; - ap = (u8_t *)&addr; + ap = (u8_t *)&s_addr; for(n = 0; n < 4; n++) { i = 0; do { diff --git a/src/include/ipv4/lwip/inet.h b/src/include/ipv4/lwip/inet.h index 01bd8a89..beab8518 100644 --- a/src/include/ipv4/lwip/inet.h +++ b/src/include/ipv4/lwip/inet.h @@ -46,7 +46,7 @@ u16_t inet_chksum_pseudo(struct pbuf *p, u32_t inet_addr(const char *cp); int inet_aton(const char *cp, struct in_addr *addr); -u8_t *inet_ntoa(u32_t addr); /* returns ptr to static buffer; not reentrant! */ +char *inet_ntoa(struct in_addr addr); /* returns ptr to static buffer; not reentrant! */ #ifdef htons #undef htons diff --git a/src/netif/ppp/ipcp.c b/src/netif/ppp/ipcp.c index 67c2061b..3da1ba67 100644 --- a/src/netif/ppp/ipcp.c +++ b/src/netif/ppp/ipcp.c @@ -178,6 +178,20 @@ static fsm_callbacks ipcp_callbacks = { /* IPCP callback routines */ /*** LOCAL FUNCTION DEFINITIONS ***/ /**********************************/ +/* + * Non-standard inet_ntoa left here for compat with original ppp + * sources. Assumes u32_t instead of struct in_addr. + */ + +char * _inet_ntoa(u32_t n) +{ + struct in_addr ia; + ia.s_addr = n; + return inet_ntoa(ia); +} + +#define inet_ntoa _inet_ntoa + /* * ipcp_init - Initialize IPCP. */