Skip to content

WAN接口IP地址发生变化后,程序仍然尝试绑定之前的IP地址,导致认证失败 #61

Description

@yburger

在openwrt的管理页面的网络-接口处重启接口后,获取到新的IP地址,但是程序在进行校园网登录认证时仍然尝试绑定之前的IP地址(即使程序似乎识别到了地址发生变化),导致远端返回bind: cannot assign requested address错误

完整DEBUG日志
# 这一分钟还没有重启接口,IP地址尚未变化,仍是10.116.212.112
2026-06-23 14:57:32 [DEBU] [comp:login] 网卡 lo 不匹配
2026-06-23 14:57:32 [DEBU] [comp:login] 网卡 eth0 不匹配
2026-06-23 14:57:32 [DEBU] [comp:login] 网卡 lan3 不匹配
2026-06-23 14:57:32 [DEBU] [comp:login] 网卡 lan2 不匹配
2026-06-23 14:57:32 [DEBU] [comp:login] 网卡 lan1 不匹配
2026-06-23 14:57:32 [DEBU] [comp:login] 网卡 wan 不匹配
2026-06-23 14:57:32 [DEBU] [comp:login] 网卡 br-lan 不匹配
2026-06-23 14:57:32 [DEBU] [comp:login] 网卡 phy0-ap0 不匹配
2026-06-23 14:57:32 [DEBU] [comp:login] 网卡 phy1-ap0 不匹配
2026-06-23 14:57:32 [DEBU] [comp:login] 网卡 zt 不匹配
2026-06-23 14:57:32 [DEBU] [comp:login] 有效匹配网卡: [{phy1-sta0 10.116.212.112:0}]
2026-06-23 14:57:32 [INFO] [comp:login] 使用网卡:  phy1-sta0
2026-06-23 14:57:32 [DEBU] [comp:login] [mod:acid] 开始嗅探
2026-06-23 14:57:32 [DEBU] [comp:login] HTTP GET http://xxx.xxx.edu.cn/
2026-06-23 14:57:32 [DEBU] [comp:login] HTTP GET https://xxx.xxx.edu.cn/
2026-06-23 14:57:32 [DEBU] [comp:login] HTTP GET https://xxx.xxx.edu.cn/index_1.html
2026-06-23 14:57:32 [DEBU] [comp:login] [mod:acid] 使用嗅探 acid: 1
2026-06-23 14:57:32 [DEBU] [comp:login] [mod:enc] 开始嗅探
2026-06-23 14:57:32 [DEBU] [comp:login] HTTP GET https://xxx.xxx.edu.cn/srun_portal_pc?ac_id=1&theme=pro
2026-06-23 14:57:32 [DEBU] [comp:login] HTTP GET http://xxx.xxx.edu.cn/static/themes/pro/js/Portal.js
2026-06-23 14:57:32 [DEBU] [comp:login] [mod:enc] 使用嗅探 enc: srun_bx1
2026-06-23 14:57:32 [DEBU] [comp:login] 正在获取登录状态
2026-06-23 14:57:32 [DEBU] [comp:login] HTTP GET http://xxx.xxx.edu.cn/cgi-bin/rad_user_info
2026-06-23 14:57:32 [DEBU] [comp:login] jQueryxxxxxx_xxxxxxx({"ServerFlag":xxxxxxx,"add_time":xxxxxxx,"all_bytes":85781682852,"billing_name":"xxxxx","bytes_in":76118601723,"bytes_out":9663081129,"checkout_date":0,"domain":"wl-n-student","error":"ok","group_id":"11","keepalive_time":1782197852,"online_device_total":"1","online_ip":"10.116.212.112","online_ip6":"2001:xxxx:xxxx:xxxx::xxxx","package_id":"0","products_id":"22","products_name":"xxxxx","real_name":"","remain_bytes":0,"remain_seconds":0,"sum_bytes":748705469259,"sum_seconds":2315030,"sysver":"1.01.20210607","user_balance":0,"user_charge":0,"user_mac":"xx:xx:xx:xx:xx:xx","user_name":"xxxxxxxxx","wallet_balance":0})
2026-06-23 14:57:32 [DEBU] [comp:login] 认证客户端 ip:  10.116.212.112
2026-06-23 14:57:32 [DEBU] [comp:login] 已登录~

# 这一分钟已经重启了接口,IP地址从10.116.212.112变成10.116.103.152
2026-06-23 14:58:32 [DEBU] [comp:login] 网卡 lo 不匹配
2026-06-23 14:58:32 [DEBU] [comp:login] 网卡 eth0 不匹配
2026-06-23 14:58:32 [DEBU] [comp:login] 网卡 lan3 不匹配
2026-06-23 14:58:32 [DEBU] [comp:login] 网卡 lan2 不匹配
2026-06-23 14:58:32 [DEBU] [comp:login] 网卡 lan1 不匹配
2026-06-23 14:58:32 [DEBU] [comp:login] 网卡 wan 不匹配
2026-06-23 14:58:32 [DEBU] [comp:login] 网卡 br-lan 不匹配
2026-06-23 14:58:32 [DEBU] [comp:login] 网卡 phy0-ap0 不匹配
2026-06-23 14:58:32 [DEBU] [comp:login] 网卡 phy1-ap0 不匹配
2026-06-23 14:58:32 [DEBU] [comp:login] 网卡 zt 不匹配
2026-06-23 14:58:32 [DEBU] [comp:login] 有效匹配网卡: [{phy1-sta0 10.116.103.152:0}]
2026-06-23 14:58:32 [INFO] [comp:login] 使用网卡:  phy1-sta0
2026-06-23 14:58:32 [DEBU] [comp:login] [mod:acid] 开始嗅探
2026-06-23 14:58:32 [DEBU] [comp:login] HTTP GET http://xxx.xxx.edu.cn/
2026-06-23 14:58:32 [WARN] [comp:login] [mod:acid] 嗅探失败,使用配置 acid: Get "http://xxx.xxx.edu.cn/": dial tcp 10.116.212.112:0->172.26.8.25:80: bind: cannot assign requested address
2026-06-23 14:58:32 [DEBU] [comp:login] [mod:enc] 开始嗅探
2026-06-23 14:58:32 [DEBU] [comp:login] HTTP GET http://xxx.xxx.edu.cn/
2026-06-23 14:58:32 [WARN] [comp:login] [mod:enc] 嗅探失败,使用配置 enc: Get "http://xxx.xxx.edu.cn/": dial tcp 10.116.212.112:0->172.26.8.25:80: bind: cannot assign requested address
2026-06-23 14:58:32 [DEBU] [comp:login] 正在获取登录状态
2026-06-23 14:58:32 [DEBU] [comp:login] HTTP GET http://xxx.xxx.edu.cn/cgi-bin/rad_user_info
2026-06-23 14:58:32 [DEBU] [comp:login] Get "http://xxx.xxx.edu.cn/cgi-bin/rad_user_info?_=xxxxxxxxx&callback=jQueryxxxxxxxx_xxxxxxx": dial tcp 10.116.212.112:0->172.26.8.25:80: bind: cannot assign requested address
2026-06-23 14:58:32 [ERRO] [comp:login] 网卡 phy1-sta0 登录出错: Get "http://xxx.xxx.edu.cn/cgi-bin/rad_user_info?_=xxxxxxx&callback=jQueryxxxxxxxxxxxxx_xxxxxxxxxx": dial tcp 10.116.212.112:0->172.26.8.25:80: bind: cannot assign requested address

2026-06-23 14:58:32 [DEBU] [comp:login] 有效匹配网卡: [{phy1-sta0 10.116.103.152:0}]
………………………………
2026-06-23 14:58:32 [DEBU] [comp:login] Get "http://xxx.xxx.edu.cn/cgi-bin/rad_user_info?_=xxxxxxxxx&callback=jQueryxxxxxxxx_xxxxxxx": dial tcp 10.116.212.112:0->172.26.8.25:80: bind: cannot assign requested address

这里明明已经能识别到新IP地址10.116.103.152了,但是下面认证又尝试绑定之前的地址10.116.212.112
只有手动重启服务之后才能恢复正常,不然会一直尝试绑定旧地址,一直失败

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions