s235784 / NJUPT_AutoLogin

南京邮电大学校园网自动登录脚本(路由器用),内附单线多拨教程
https://nuotian.furry.pro/blog/archives/347
Apache License 2.0
28 stars 2 forks source link

Use `grep "inet "` to prevent getting IPv6 addresses #5

Closed Glucy-2 closed 10 months ago

Glucy-2 commented 10 months ago

If the interface have IPv6 addrs:

ethx: flags=xxxx<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.165.xxx.xxx  netmask 255.255.128.0  broadcast 10.162.255.255
        inet6 2001:da8:1032:6004::xxxx  prefixlen 128  scopeid 0x0<global>
        inet6 fe80::xxxx:xxxx:xxxx:xxxx  prefixlen 64  scopeid 0x20<link>

The script will not work properly:

无法判断网络状态,尝试登录
当前设备的ip地址为10.165.xxx.xxx
2001810326004xxxx
fe80xxxxxxxxxxx
运营商为电信
curl: (3) URL rejected: Malformed input to a URL function

接口请求错误:
如果问题持续出现,请在GitHub上提交Issue

This PR fixes this.