Networking

wpa_supplicant:禁用 IPv6

  • August 3, 2021

我的系統不支持IPv6,我只使用IPv4. 我的wpa_supplicant日誌充斥著以下錯誤消息:

wpa_supplicant[3370]:  nl80211: Failed to open /proc/sys/net/ipv6/conf/wlan0/drop_unicast_in_l2_multicast: No such file or directory
wpa_supplicant[3370]:  nl80211: Failed to set IPv6 unicast in multicast filter

這本身是無害的,但很難真正找到其他有用的資訊。

我怎麼知道wpa_supplicant只使用IPv4而不是嘗試配置IPv6

正如我在您的另一篇文章中提到的,在 wpa_supplicant 中無法禁用 IPv6 支持。如果您的唯一目標是阻止 wpa_supplicant 記錄問題中提到的兩個錯誤,只需複製原始碼並通過註釋掉設置 IPv6 參數的行來修改此函式。

// comment out these lines in nl80211_configure_data_frame_filters(...)

static int nl80211_configure_data_frame_filters(void *priv, u32 filter_flags)
{
   struct i802_bss *bss = priv;
   char path[128];
   int ret;

   /* P2P-Device has no netdev that can (or should) be configured here */
   if (nl80211_get_ifmode(bss) == NL80211_IFTYPE_P2P_DEVICE)
       return 0;

   wpa_printf(MSG_DEBUG, "nl80211: Data frame filter flags=0x%x",
          filter_flags);

   /* Configure filtering of unicast frame encrypted using GTK */
   ret = os_snprintf(path, sizeof(path),
             "/proc/sys/net/ipv4/conf/%s/drop_unicast_in_l2_multicast",
             bss->ifname);
   if (os_snprintf_error(sizeof(path), ret))
       return -1;

   ret = nl80211_write_to_file(path,
                   !!(filter_flags &
                      WPA_DATA_FRAME_FILTER_FLAG_GTK));
   if (ret) {
       wpa_printf(MSG_ERROR,
              "nl80211: Failed to set IPv4 unicast in multicast filter");
       return ret;
   }

/** THIS BLOCK
   os_snprintf(path, sizeof(path),
           "/proc/sys/net/ipv6/conf/%s/drop_unicast_in_l2_multicast",
           bss->ifname);
   ret = nl80211_write_to_file(path,
                   !!(filter_flags &
                      WPA_DATA_FRAME_FILTER_FLAG_GTK));

   if (ret) {
       wpa_printf(MSG_ERROR,
              "nl80211: Failed to set IPv6 unicast in multicast filter");
       return ret;
   }
**/

   /* Configure filtering of unicast frame encrypted using GTK */
   os_snprintf(path, sizeof(path),
           "/proc/sys/net/ipv4/conf/%s/drop_gratuitous_arp",
           bss->ifname);
   ret = nl80211_write_to_file(path,
                   !!(filter_flags &
                      WPA_DATA_FRAME_FILTER_FLAG_ARP));
   if (ret) {
       wpa_printf(MSG_ERROR,
              "nl80211: Failed set gratuitous ARP filter");
       return ret;
   }

   /* Configure filtering of IPv6 NA frames */
/** THIS BLOCK
   os_snprintf(path, sizeof(path),
           "/proc/sys/net/ipv6/conf/%s/drop_unsolicited_na",
           bss->ifname);
   ret = nl80211_write_to_file(path,
                   !!(filter_flags &
                      WPA_DATA_FRAME_FILTER_FLAG_NA));
   if (ret) {
       wpa_printf(MSG_ERROR,
              "nl80211: Failed to set unsolicited NA filter");
       return ret;
   }
**/

   return 0;
}

但實際上您應該做的是向Hostap的人員(hostap@lists.infradead.org) 發送一封電子郵件,並說明您不支持 IPv6,並且 wpa_supplicant 正在向您的日誌發送垃圾郵件,您希望它停止。老實說,維護人員在回答問題時很容易受到影響,因此請確保您清楚地提出問題,並提供他們進行評估所需的所有資訊。

引用自:https://unix.stackexchange.com/questions/658943