+ syslog (LOG_NOTICE, "attached TTY %s to netdevice %s\n", ttypath, buf);
+
+ /* try to rename the created netdevice */
+ if (name) {
+ struct ifreq ifr;
+ int s = socket(PF_INET, SOCK_DGRAM, 0);
+ if (s < 0)
+ perror("socket for interface rename");
+ else {
+ strncpy (ifr.ifr_name, buf, IFNAMSIZ);
+ strncpy (ifr.ifr_newname, name, IFNAMSIZ);
+
+ if (ioctl(s, SIOCSIFNAME, &ifr) < 0) {
+ syslog (LOG_NOTICE, "netdevice %s rename to %s failed\n", buf, name);
+ perror("ioctl SIOCSIFNAME rename");
+ exit(1);
+ } else
+ syslog (LOG_NOTICE, "netdevice %s renamed to %s\n", buf, name);
+
+ close(s);
+ }
+ }
+