Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uPnP无法使用 #96

Open
ghost opened this issue Jun 8, 2024 · 15 comments
Open

uPnP无法使用 #96

ghost opened this issue Jun 8, 2024 · 15 comments

Comments

@ghost
Copy link

ghost commented Jun 8, 2024

光猫侧已开启upnp,没有二级路由
Python 3.12.3
Natter 2.1.1
执行sudo natter.py -v -m iptables -p 55555 -U

2024-06-08 09:15:13 [I] Natter v2.1.1
2024-06-08 09:15:13 [D] fwd-iptables: Found iptables (1, 8, 10)
2024-06-08 09:15:13 [D] fwd-iptables: Cleaning up Natter rules
2024-06-08 09:15:14 [D] stun: Got address tcp://111.111.111.111:6452 from tcp://fwa.lifesizecloud.com:3478, source tcp://192.168.1.31:35413
2024-06-08 09:15:14 [D] keep-alive: Connected to host tcp://www.baidu.com:80
2024-06-08 09:15:17 [D] keep-alive: OK
2024-06-08 09:15:17 [D] stun: Got address tcp://111.111.111.111:6452 from tcp://fwa.lifesizecloud.com:3478, source tcp://192.168.1.31:35413
2024-06-08 09:15:17 [D] fwd-iptables: Adding rule tcp://192.168.1.31:35413 forward to tcp://192.168.1.31:55555
2024-06-08 09:15:17 [I] 
2024-06-08 09:15:17 [I] Scanning UPnP Devices...
2024-06-08 09:15:17 [D] upnp: Got URL http://192.168.1.3:37443/upnpap.xml
2024-06-08 09:15:17 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-08 09:15:17 [D] upnp: Got URL http://192.168.1.3:37443/upnpap.xml
2024-06-08 09:15:17 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-08 09:15:17 [D] upnp: Got URL http://192.168.1.3:37443/upnpap.xml
2024-06-08 09:15:17 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-08 09:15:17 [D] upnp: Got URL http://192.168.1.3:37443/upnpap.xml
2024-06-08 09:15:17 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-08 09:15:17 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-08 09:15:17 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-08 09:15:17 [D] upnp: Got URL http://192.168.1.3:37443/upnpap.xml
2024-06-08 09:15:17 [D] upnp: Got URL http://192.168.1.3:37443/upnpap.xml
2024-06-08 09:15:17 [D] upnp: Got URL http://192.168.1.3:37443/upnpap.xml
2024-06-08 09:15:17 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-08 09:15:17 [D] upnp: Got URL http://192.168.1.3:37443/upnpap.xml
2024-06-08 09:15:17 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-08 09:15:17 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-08 09:15:17 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-08 09:15:17 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-08 09:15:17 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-08 09:15:17 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-08 09:15:17 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-08 09:15:18 [E] upnp: failed to load service from http://192.168.1.3:37443/upnpap.xml: Invalid response from HTTP server
Traceback (most recent call last):
  File "/usr/bin/natter.py", line 1849, in <module>
    main()
  File "/usr/bin/natter.py", line 1840, in main
    natter_main(show_title)
  File "/usr/bin/natter.py", line 1730, in natter_main
    upnp_router = upnp.discover_router()
                  ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/natter.py", line 1220, in discover_router
    devs = self._discover()
           ^^^^^^^^^^^^^^^^
  File "/usr/bin/natter.py", line 1285, in _discover
    d._load_services()
  File "/usr/bin/natter.py", line 1132, in _load_services
    services_d.update(sd)
TypeError: 'NoneType' object is not iterable
2024-06-08 09:15:18 [D] fwd-iptables: Cleaning up Natter rules

@Droid-MAX
Copy link

换个角度想,有没有可能是光猫的UPnP组件的问题?

@ghost
Copy link
Author

ghost commented Jun 8, 2024

应该不能吧
图片

@MikeWang000000
Copy link
Owner

这种情况比较少见,像是光猫没有返回标准的 HTTP 响应。

Natter/natter.py

Line 1164 in f8257e8

sock.close()

将 1164 行 sock.close() 临时改成 sock.close(); print(response)

然后发一下输出的内容呢?IP 地址等敏感信息可以隐去。

@ghost
Copy link
Author

ghost commented Jun 10, 2024

╰─ sudo ./natter.py -v -m iptables -p 55555 -U
2024-06-10 19:05:46 [I] Natter v2.1.1
2024-06-10 19:05:46 [D] fwd-iptables: Found iptables (1, 8, 10)
2024-06-10 19:05:46 [D] fwd-iptables: Cleaning up Natter rules
2024-06-10 19:05:46 [D] stun: Got address tcp://111.111.111.111:6600 from tcp://fwa.lifesizecloud.com:3478, source tcp://192.168.1.31:33817
2024-06-10 19:05:46 [D] keep-alive: Connected to host tcp://www.baidu.com:80
2024-06-10 19:05:49 [D] keep-alive: OK
2024-06-10 19:05:50 [D] stun: Got address tcp://111.111.111.111:6600 from tcp://fwa.lifesizecloud.com:3478, source tcp://192.168.1.31:33817
2024-06-10 19:05:50 [D] fwd-iptables: Adding rule tcp://192.168.1.31:33817 forward to tcp://192.168.1.31:55555
2024-06-10 19:05:50 [I] 
2024-06-10 19:05:50 [I] Scanning UPnP Devices...
2024-06-10 19:05:50 [D] upnp: Got URL http://192.168.1.3:37443/upnpap.xml
2024-06-10 19:05:50 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-10 19:05:50 [D] upnp: Got URL http://192.168.1.3:37443/upnpap.xml
2024-06-10 19:05:50 [D] upnp: Got URL http://192.168.1.3:37443/upnpap.xml
2024-06-10 19:05:50 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-10 19:05:50 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-10 19:05:50 [D] upnp: Got URL http://192.168.1.3:37443/upnpap.xml
2024-06-10 19:05:50 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-10 19:05:50 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-10 19:05:50 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-10 19:05:50 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-10 19:05:50 [D] upnp: Got URL http://192.168.1.3:37443/upnpap.xml
2024-06-10 19:05:50 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-10 19:05:50 [D] upnp: Got URL http://192.168.1.3:37443/upnpap.xml
2024-06-10 19:05:50 [D] upnp: Got URL http://192.168.1.3:37443/upnpap.xml
2024-06-10 19:05:50 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-10 19:05:50 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-10 19:05:50 [D] upnp: Got URL http://192.168.1.3:37443/upnpap.xml
2024-06-10 19:05:50 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-10 19:05:50 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-10 19:05:50 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-10 19:05:50 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
b''
2024-06-10 19:05:51 [E] upnp: failed to load service from http://192.168.1.3:37443/upnpap.xml: Invalid response from HTTP server
Traceback (most recent call last):
  File "/home/papklp/Natter/./natter.py", line 1849, in <module>
    main()
  File "/home/papklp/Natter/./natter.py", line 1840, in main
    natter_main(show_title)
  File "/home/papklp/Natter/./natter.py", line 1730, in natter_main
    upnp_router = upnp.discover_router()
                  ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/papklp/Natter/./natter.py", line 1220, in discover_router
    devs = self._discover()
           ^^^^^^^^^^^^^^^^
  File "/home/papklp/Natter/./natter.py", line 1285, in _discover
    d._load_services()
  File "/home/papklp/Natter/./natter.py", line 1132, in _load_services
    services_d.update(sd)
TypeError: 'NoneType' object is not iterable
2024-06-10 19:05:51 [D] fwd-iptables: Cleaning up Natter rules

似乎是同样的报错

@Droid-MAX
Copy link

别用光猫

@ghost
Copy link
Author

ghost commented Jun 10, 2024

又试了一下gopeed和qbittorrent,都可以正常upnp

@MikeWang000000
Copy link
Owner

手动捂脸,http://192.168.1.3:37443/upnpap.xml 光猫响应的这个地址是不是打不开?
然后再试试 http://192.168.1.1:49652/49652gatedesc.xml

@MikeWang000000
Copy link
Owner

别用光猫

也不能说别用光猫,光猫的内置功能可能比较粗糙,我们对一些不正常的现象做一些容错处理,也是能用的。

@ghost
Copy link
Author

ghost commented Jun 11, 2024

192.168.1.1的可以打开,192.168.1.3的不行

@Droid-MAX
Copy link

怪了,有两个upnp网关?

@ghost
Copy link
Author

ghost commented Jun 12, 2024

1.3是从光猫

@Droid-MAX
Copy link

那就是局域网内有多个upnp网关设备?

@ghost
Copy link
Author

ghost commented Jun 13, 2024

是这样,从光猫的upnp关不掉

@ghost
Copy link
Author

ghost commented Jun 15, 2024

把从光猫的ip屏蔽掉也是一样

╰─ sudo natter.py -v -m iptables -p 55555 -U                                  ─╯
2024-06-15 12:40:51 [I] Natter v2.1.1
2024-06-15 12:40:51 [D] fwd-iptables: Found iptables (1, 8, 10)
2024-06-15 12:40:51 [D] fwd-iptables: Creating Natter chain
2024-06-15 12:40:51 [D] fwd-iptables: Cleaning up Natter rules
2024-06-15 12:40:52 [D] stun: Got address tcp://111.111.111.111:5323 from tcp://fwa.lifesizecloud.com:3478, source tcp://192.168.1.31:36207
2024-06-15 12:40:52 [D] keep-alive: Connected to host tcp://www.baidu.com:80
2024-06-15 12:40:55 [D] keep-alive: OK
2024-06-15 12:40:55 [D] stun: Got address tcp://111.111.111.111:5323 from tcp://fwa.lifesizecloud.com:3478, source tcp://192.168.1.31:36207
2024-06-15 12:40:55 [D] fwd-iptables: Adding rule tcp://192.168.1.31:36207 forward to tcp://192.168.1.31:55555
2024-06-15 12:40:55 [I] 
2024-06-15 12:40:55 [I] Scanning UPnP Devices...
2024-06-15 12:40:55 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-15 12:40:55 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-15 12:40:55 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-15 12:40:55 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-15 12:40:55 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-15 12:40:55 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-15 12:40:55 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-15 12:40:55 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-15 12:40:55 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-15 12:40:55 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-15 12:40:55 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-15 12:40:55 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-15 12:40:55 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
2024-06-15 12:40:55 [D] upnp: Got URL http://192.168.1.1:49652/49652gatedesc.xml
b''
2024-06-15 12:40:56 [E] upnp: failed to load service from http://192.168.1.1:49652/49652gatedesc.xml: Invalid response from HTTP server
Traceback (most recent call last):
  File "/usr/bin/natter.py", line 1849, in <module>
    main()
  File "/usr/bin/natter.py", line 1840, in main
    natter_main(show_title)
  File "/usr/bin/natter.py", line 1730, in natter_main
    upnp_router = upnp.discover_router()
                  ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/natter.py", line 1220, in discover_router
    devs = self._discover()
           ^^^^^^^^^^^^^^^^
  File "/usr/bin/natter.py", line 1285, in _discover
    d._load_services()
  File "/usr/bin/natter.py", line 1132, in _load_services
    services_d.update(sd)
TypeError: 'NoneType' object is not iterable
2024-06-15 12:40:56 [D] fwd-iptables: Cleaning up Natter rules

@Little100
Copy link

我也遇到同样的问题了 之前的光猫是F4610u 10G EPON可以正常使用 现在换成了HN8346x6-c 10G EPON就不能用了
不过开DMZ可以 只是DMZ只能一个设备就挺难受的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants