mkaddr c code
There is another version of mkaddr.c subroutine which is using inet_addr. The problem with inet_addr(3) is that it returns the value INADDR_NONE when an address is invalid. When the IP address 255.255.255.255 is converted to a 32-bit value, its return value is identical to the constant INADDR_NONE.
Consequently, it becomes impossible to distinguish between a bad input IP address, and the general broadcast address. Use of the inet_aton(3) function avoids this ambiguity.
As written, has potential memory leaks: error returns do not call free(inp_addr)
ReplyDeleteYes, you are correct. We will update the code soon. You can also post the suggest fix we will add your changes too.
DeleteThanks.
I keep getting "Undefined reference to mkaddr" when I try to compile this. What am I doing wrong?
ReplyDeleteThis comment has been removed by the author.
Deletekya bola tu?
DeleteCan you show us the code that you are using ? Seems you have missed to add the function.
ReplyDelete