freebsd: SIOCSIFADDR returns EINVAL
I am trying to set the IP address of an interface. The interface is virtual (vtnet0) if that matters.
The SIOCGIFADDR ioctl works, but I can't get the set to work. Here is the code fragment: Code:
static int set_ip(const char *ifname, const char *ip, unsigned mask, int down) |
Refer to ifconfig(8).
You need a ifconfig_<interface> stanza in rc.conf(8) to bring up the interface on boot. |
Ok, I solved it. You can't use SIOCSIFADDR, or SIOCIFNETMASK, you must use SIOCAIFADDR (note the A) which takes an ifaliasreq struct. You still use SIOCSIFFLAGS though.
|
All times are GMT -5. The time now is 12:17 PM. |