免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 9064 | 回复: 2
打印 上一主题 下一主题

[应用] wpa_supplicant 移植后运行报错,无招了! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-08-29 10:28 |只看该作者 |倒序浏览
wpa_supplicant移植后(环境为:s3c2416、kernel 2.6.36、busybox1.18.4、wifi为marvell sdio 88w8686)运行
wpa_supplicant -d -iwlan2 -c/etc/p2p.conf
报错:
…………
EAP: EAP entering state DISABLED
EAPOL: Supplicant port status: Unauthorized
EAPOL: Supplicant port status: Unauthorized
socket(PF_UNIX): Address family not supported by protocol
Failed to initialize control interface '/var/run/wpa_supplicant'.
You may have another wpa_supplicant process already running or the file was
left by an unclean termination of wpa_supplicant in which case you will need
to manually remove this file before starting wpa_supplicant again.

Failed to add interface wlan2
wlan2: No keys have been configured - skip key clearing
wlan2: State: DISCONNECTED -> DISCONNECTED
…………


跟踪socket(PF_UNIX): Address family not supported by protocol发现到了函数wpa_supplicant_global_ctrl_iface_init就报错了,
  1.         priv->sock = socket(PF_UNIX, SOCK_DGRAM, 0);
  2.         if (priv->sock < 0) {
  3.                 perror("socket(PF_UNIX)");
  4.                 goto fail;
  5.         }
复制代码
是socket函数error:Address family not supported by protocol

流程为:main()函数-->解析命令行参数(main.c)-->wpa_supplicant_init()(wpa_supplicant.c)-->wpa_supplicant_global_ctrl_iface_init()(ctrl_iface_unix.c)-->socket()

将priv->sock = socket(PF_UNIX, SOCK_DGRAM, 0);改为priv->sock = socket(PF_INET, SOCK_DGRAM, 0);
如:
  1. /*        priv->sock = socket(PF_UNIX, SOCK_DGRAM, 0);*/
  2.         priv->sock = socket(PF_INET, SOCK_DGRAM, 0);
  3.         if (priv->sock < 0) {
  4.                 perror("socket(PF_INET)");
  5.                 wpa_printf(MSG_DEBUG,"--------priv->sock = %d ---------\n",priv->sock);
  6.                 goto fail;
  7.         }

  8.         os_memset(&addr, 0, sizeof(addr));
  9. #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
  10.         addr.sun_len = sizeof(addr);
  11. #endif /* __FreeBSD__ */
  12. /*        addr.sun_family = AF_UNIX;*/
  13.         addr.sun_family = PF_INET;
  14.         fname = wpa_supplicant_ctrl_iface_path(wpa_s);
  15.         if (fname == NULL)
  16.                 goto fail;
  17.         os_strlcpy(addr.sun_path, fname, sizeof(addr.sun_path));
  18.         if ( bind(priv->sock, (struct sockaddr *) &addr, sizeof(struct sockaddr_un)) == -1 ) {
  19.                 wpa_printf(MSG_DEBUG, "errno = %d and ctrl_iface bind(PF_UNIX) failed: %s",
  20.                            errno,strerror(errno));
复制代码
改了后,socket函数OK,但下面bind又出错了:
EAPOL: Supplicant port status: Unauthorized
EAPOL: Supplicant port status: Unauthorized
Using existing control interface directory.
errno = 99 and ctrl_iface bind(PF_UNIX) failed: Cannot assign requested address
ctrl_iface exists and seems to be in use - cannot override it
Delete '/var/run/wpa_supplicant/wlan2' manually if it is not used anymore
Failed to initialize control interface '/var/run/wpa_supplicant'.
You may have another wpa_supplicant process already running or the file was
left by an unclean termination of wpa_supplicant in which case you will need
to manually remove this file before starting wpa_supplicant again.

Failed to add interface wlan2


目前不知道咋办了?哪位大虾有搞过这个的,指点下啊,感谢!

论坛徽章:
0
2 [报告]
发表于 2011-08-29 17:38 |只看该作者
这个问题,没搞过。
但个人觉得应该看看你的Kernel配置是否支持了PF_UNIX协议栈,如果没有,该为支持再试试看。

论坛徽章:
0
3 [报告]
发表于 2011-08-29 20:05 |只看该作者
很奇怪,将wpa_supplicant的配置文件中wpa_supplicant.conf中的:
ctrl_interface=/var/run/wpa_supplicant
注释掉,竟然没有上面所说的错误了(怀疑是程序没有执行到那个socket),但wpa_supplicant可以工作啊!
# wpa_supplicant -B -iwlan2 -c/etc/wpa_supplicant.conf
#  /sbin/udhcpc -i wlan2
竟然可以连上路由,得到IP,可以PING通啦!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP