Revision: 24618
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 5, 2010 07:30 by sukantahazra
Initial Code
static int set_ip_using(const char *name, int c, unsigned long ip) { struct ifreq ifr; struct sockaddr_in sin; safe_strncpy(ifr.ifr_name, name, IFNAMSIZ); memset(&sin, 0, sizeof(struct sockaddr)); sin.sin_family = AF_INET; sin.sin_addr.s_addr = ip; memcpy(&ifr.ifr_addr, &sin, sizeof(struct sockaddr)); if (ioctl(skfd, c, &ifr) < 0) return -1; return 0; }
Initial URL
Initial Description
Initial Title
Linux set ip address using ioctl
Initial Tags
linux
Initial Language
C