fix inet_ntoa prototype to be standard, and fix ppp code that used the non-standard version

This commit is contained in:
jani 2004-03-10 13:23:04 +00:00
parent f9dea9d35b
commit 30e5dfddb9
3 changed files with 18 additions and 3 deletions

View File

@ -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 {

View File

@ -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

View File

@ -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.
*/