-static void up_iface(void)
-{
- struct ifreq ifrequest;
-
- if (!G.iface_exists)
- return;
-
- set_ifreq_to_ifname(&ifrequest);
- if (network_ioctl(SIOCGIFFLAGS, &ifrequest) < 0) {
- bb_perror_msg("can't %cet interface flags", 'g');
- G.iface_exists = 0;
- return;
- }
-
- if (!(ifrequest.ifr_flags & IFF_UP)) {
- ifrequest.ifr_flags |= IFF_UP;
- /* Let user know we mess up with interface */
- bb_error_msg("upping interface");
- if (network_ioctl(SIOCSIFFLAGS, &ifrequest) < 0)
- bb_perror_msg_and_die("can't %cet interface flags", 's');
- }
-
-#if 0 /* why do we mess with IP addr? It's not our business */
- if (network_ioctl(SIOCGIFADDR, &ifrequest) < 0) {
- bb_error_msg("can't get interface address");
- } else if (ifrequest.ifr_addr.sa_family != AF_INET) {
- bb_perror_msg("the interface is not IP-based");
- } else {
- ((struct sockaddr_in*)(&ifrequest.ifr_addr))->sin_addr.s_addr = INADDR_ANY;
- if (network_ioctl(SIOCSIFADDR, &ifrequest) < 0)
- bb_perror_msg("can't set interface address");
- }
- if (network_ioctl(SIOCGIFFLAGS, &ifrequest) < 0) {
- bb_perror_msg("can't get interface flags");
- return;
- }
-#endif
-}
-
-static void maybe_up_new_iface(void)
-{
- if (!(option_mask32 & FLAG_NO_AUTO))
- up_iface();
-
-#if 0 /* bloat */
- struct ifreq ifrequest;
- struct ethtool_drvinfo driver_info;
-
- set_ifreq_to_ifname(&ifrequest);
- driver_info.cmd = ETHTOOL_GDRVINFO;
- ifrequest.ifr_data = &driver_info;
- if (network_ioctl(SIOCETHTOOL, &ifrequest) == 0) {
- char buf[sizeof("/xx:xx:xx:xx:xx:xx")];
-
- /* Get MAC */
- buf[0] = '\0';
- set_ifreq_to_ifname(&ifrequest);
- if (network_ioctl(SIOCGIFHWADDR, &ifrequest) == 0) {
- sprintf(buf, "/%02X:%02X:%02X:%02X:%02X:%02X",
- (uint8_t)(ifrequest.ifr_hwaddr.sa_data[0]),
- (uint8_t)(ifrequest.ifr_hwaddr.sa_data[1]),
- (uint8_t)(ifrequest.ifr_hwaddr.sa_data[2]),
- (uint8_t)(ifrequest.ifr_hwaddr.sa_data[3]),
- (uint8_t)(ifrequest.ifr_hwaddr.sa_data[4]),
- (uint8_t)(ifrequest.ifr_hwaddr.sa_data[5]));
- }
-
- bb_error_msg("using interface %s%s with driver<%s> (version: %s)",
- G.iface, buf, driver_info.driver, driver_info.version);
- }
-#endif
-
- G.cached_detect_link_func = NULL;
-}