--- embedtools/src/get1steth.c 2011/06/08 12:45:41 1.2 +++ embedtools/src/get1steth.c 2011/06/13 20:04:12 1.2.2.1 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ - * $Id: get1steth.c,v 1.2 2011/06/08 12:45:41 misho Exp $ + * $Id: get1steth.c,v 1.2.2.1 2011/06/13 20:04:12 misho Exp $ * *************************************************************************/ #include "global.h" @@ -170,25 +170,26 @@ int main(int argc, char **argv) MGMT_IFACE, errno, strerror(errno)); close(s); return 2; - } else - VERB(2) syslog(LOG_NOTICE, "Info:: Created interface=%s\n", MGMT_IFACE); + } + + memset(&ifra, 0, sizeof ifra); +#if defined(__FreeBSD__) // rename iface + VERB(2) syslog(LOG_NOTICE, "Info:: Created interface=%s\n", MGMT_IFACE); ifr.ifr_data = MGMT_NAME; -#ifdef SIOCSIFNAME if (errno != EEXIST && ioctl(s, SIOCSIFNAME, &ifr) == -1) { -#else - if (errno != EEXIST && ioctl(s, SIOCGIFDESCR, &ifr) == -1) { -#endif syslog(LOG_ERR, "Error:: Managment interface=%s ioctl(SIOCSIFNAME) #%d - %s\n", MGMT_NAME, errno, strerror(errno)); close(s); return 2; } else VERB(2) syslog(LOG_NOTICE, "Info:: Managment interface=%s\n", MGMT_NAME); + strlcpy(ifra.ifra_name, MGMT_NAME, IFNAMSIZ); +#else + strlcpy(ifra.ifra_name, MGMT_IFACE, IFNAMSIZ); +#endif // assign address & up - memset(&ifra, 0, sizeof ifra); - strlcpy(ifra.ifra_name, MGMT_NAME, IFNAMSIZ); sin = (struct sockaddr_in*) &ifra.ifra_addr; sin->sin_len = sizeof ifra.ifra_addr; sin->sin_family = AF_INET;