bind() to interface ip addr fails

Ilya Varlashkin ilya at samara.net
Mon Jan 26 07:49:34 PST 2004


Hi

I've noticed that some programs that try to bind() to specific ip address
(as opposite to INADDR_ANY) fail to start. I've made simple test
(http://citadel.nobulus.com/~ilya/daemon.c) and can observe that if
I try to bind() to INADDR_ANY or to 127.0.0.1 then everything is fine.
But if I specify ip address of my ethernet interface, then I get
"can't bind() - Can't assign requested address (errno=49)".

I thought that perhaps it's "big-endian" problem in inet_addr, but
that proved wrong (I assigned IP address directly after htonl() conversion).

This problem I have since 5.1-RELEASE and now with 5.2-RELEASE the problem
is still there. I use Sun HME ethernet NIC on Ultra-10 and have no possibility
to verify with other network cards at the moment.

Could somebody please have a look into this whether it's problem with hme
driver or with bind()?

P.S.: If you need some more info or if you want me to test some code,
just let me know. I'm not a programmer, but I'll try my best.

Kind regards,
Ilya Varlashkin



More information about the freebsd-sparc64 mailing list