FindGateway routine is based on a false assumption
Find information to forward eMule ports
Status: Alpha
Brought to you by:
zangune
Up to version [0.16] the FindGateway routine assumes the gateway value is the first occurrence after 0.0.0.0 in route output. This works (as far as I know), but it is not true that always the one listed is the default gateway.
More than this arz should show the default gateway only.
This is in the output of the ROUTE PRINT command (edit) in Windows XP (Windows 7 is similar):
C:\Documents and Settings\Zangune>ROUTE PRINT
===========================================================================
Elenco interfacce
0x1 ........................... MS TCP Loopback interface
0x2 ...00 13 d4 62 6f c8 ...... NIC Fast Ethernet PCI Realtek RTL8139 Family - V
irtualBox Bridged Networking Driver Miniport
0x3 ...08 00 27 00 74 39 ...... VirtualBox Host-Only Ethernet Adapter
===========================================================================
===========================================================================
Route attive:
Indirizzo rete Mask Gateway Interfac. Metric
0.0.0.0 0.0.0.0 192.168.2.1 192.168.2.2 20
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
192.168.2.0 255.255.255.0 192.168.2.2 192.168.2.2 20
192.168.2.2 255.255.255.255 127.0.0.1 127.0.0.1 20
192.168.2.255 255.255.255.255 192.168.2.2 192.168.2.2 20
192.168.56.0 255.255.255.0 192.168.56.1 192.168.56.1 20
192.168.56.1 255.255.255.255 127.0.0.1 127.0.0.1 20
192.168.56.255 255.255.255.255 192.168.56.1 192.168.56.1 20
224.0.0.0 240.0.0.0 192.168.2.2 192.168.2.2 20
224.0.0.0 240.0.0.0 192.168.56.1 192.168.56.1 20
255.255.255.255 255.255.255.255 192.168.2.2 192.168.2.2 1
255.255.255.255 255.255.255.255 192.168.56.1 192.168.56.1 1
Gateway predefinito: 192.168.2.1
===========================================================================
Route permanenti:
Nessuno
so the default gateway is clearly showed at bottom.
Anonymous
Fixed in [0.17], new FindGateway routine:Related
Code: 0.17
Last edit: Zangune 2025-05-26
Last edit: Zangune 2015-10-18
Bad user "feedback":
no gateway address.
At least in Windows 8.1 the ROUTE PRINT output is completely different from a Windows XP one.
Last edit: Zangune 2015-10-18
I will do a regression and use old code for now.
It seems the false assumption is valid for the vast majority of users as I didn't find anyone with a different gateway for now.
Last edit: Zangune 2015-10-18
Indeed, Windows version is relevant, but I still don't know starting from which version Windows ROUTE PRINT output changed. Probably, Windows 8 or Windows 8.1.
Last edit: Zangune 2023-12-29