Project

General

Profile

Actions

Bug #12867

closed

In some cases, incorrect subnet settings prevent static routes from being set correctly after a system restart.

Added by RUI YUAN over 3 years ago. Updated over 3 years ago.

Status:
Not a Bug
Priority:
Low
Assignee:
-
Category:
Interfaces
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
Release Notes:
Default
Affected Version:
Affected Architecture:
All

Description

After a simple analysis, it seems that the problem is in the following code range. I suspect it is pfSense_interface_setaddress, because I used the subnet result of /30 to check ifconfig and found that /32 was allocated.

[22.01-RELEASE][]/var/log: ifconfig igb2
igb2: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
description: IPLCWan
options=e527bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,WOL_MAGIC,VLAN_HWFILTER,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6>
ether 00:25:90:ba:0f:f2
inet6 fe80::225:90ff:feba:ff2%igb2 prefixlen 64 scopeid 0x3
inet XXX.XXX.XXX.XXX netmask 0xffffffff broadcast XXX.XXX.XXX.XXX
inet XXX.XXX.XXX.XXX netmask 0xfffffffc broadcast XXX.XXX.XXX.XXX
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

[22.01-RELEASE][]/var/log: ifconfig igb2 inet XXX.XXX.XXX.XXX/30

[22.01-RELEASE][]/var/log: ifconfig igb2
igb2: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
description: IPLCWan
options=e527bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,WOL_MAGIC,VLAN_HWFILTER,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6>
ether 00:25:90:ba:0f:f2
inet6 fe80::225:90ff:feba:ff2%igb2 prefixlen 64 scopeid 0x3
inet XXX.XXX.XXX.XXX netmask 0xfffffffc broadcast XXX.XXX.XXX.XXX
inet XXX.XXX.XXX.XXX netmask 0xfffffffc broadcast XXX.XXX.XXX.XXX
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

switch ($wancfg['ipaddr']) {
case 'dhcp':
interface_dhcp_configure($interface);
break;
case 'pppoe':
case 'l2tp':
case 'pptp':
case 'ppp':
interface_ppps_configure($interface);
break;
default:
/* XXX: Kludge for now related to #3280 */
if (!in_array($tunnelif, array("gif", "gre", "ovp", "ips"))) {
if (is_ipaddrv4($wancfg['ipaddr']) && $wancfg['subnet'] <> "") {
pfSense_interface_setaddress($realif, "{$wancfg['ipaddr']}/{$wancfg['subnet']}");
}
}
break;
}

Files

bug1.png (30.2 KB) bug1.png reboot after interface ip config RUI YUAN, 02/24/2022 07:47 AM
bug2.png (43.1 KB) bug2.png interface ipv4 configuration RUI YUAN, 02/24/2022 07:47 AM
bug3.png (34.2 KB) bug3.png gateway config RUI YUAN, 02/24/2022 07:47 AM
bug4.png (38.7 KB) bug4.png gateway status RUI YUAN, 02/24/2022 07:47 AM
bug5.png (39.2 KB) bug5.png solution RUI YUAN, 02/24/2022 07:47 AM
bug6.png (41.2 KB) bug6.png Gateway works fine RUI YUAN, 02/24/2022 07:47 AM
Actions #1

Updated by Jim Pingle over 3 years ago

  • Status changed from New to Incomplete
  • Priority changed from High to Low

There isn't enough information here. You haven't clearly defined the actual problem or the steps to reproduce it, only what you think the cause and solution might be. What is your defined interface address? What static route are you trying to add? What actually fails? What error messages do you see?

You need to discuss and diagnose this on the forum until a more accurate problem description and determination can be made: https://forum.netgate.com

Actions #2

Updated by RUI YUAN over 3 years ago

Jim Pingle wrote in #note-1:

There isn't enough information here. You haven't clearly defined the actual problem or the steps to reproduce it, only what you think the cause and solution might be. What is your defined interface address? What static route are you trying to add? What actually fails? What error messages do you see?

You need to discuss and diagnose this on the forum until a more accurate problem description and determination can be made: https://forum.netgate.com

I set up an interface and set up 2 IPs: IPV4 and Virtual Ips bug2.png
Then I execute reboot.
The gateway status after restart is:bug4.png
Then I check the gateway settings:bug3.png
Then I check the configuration of the interface: bug1.png
I found out that the netmask of the interface's ip address (ipv4 configuration) is not the correct fffffffc but the wrong ffffffff(bug1.png)
I set the netmask to be correct: bug5.png
Gateway works fine bug6.png

During startup:
Setting up static routes...
route: writing to routing socket: Network is unreachable

Actions #3

Updated by RUI YUAN over 3 years ago

Jim Pingle wrote in #note-1:

There isn't enough information here. You haven't clearly defined the actual problem or the steps to reproduce it, only what you think the cause and solution might be. What is your defined interface address? What static route are you trying to add? What actually fails? What error messages do you see?

You need to discuss and diagnose this on the forum until a more accurate problem description and determination can be made: https://forum.netgate.com

That is to say, I set interface netmask /30, but after restarting and reading config.xml, the mask will become /32 (ifconfig)
This is incorrect. I checked config.xml and the configuration inside is correct.

Actions #4

Updated by Jim Pingle over 3 years ago

I tried to recreate the problem and could not. My subnet mask was always applied correctly. There must be something else in your configuration causing the problem but there is still not enough information to go on.

Again, please take this to the forum as this is not the place to diagnose your problem. When you create a forum thread, include all of the information posted here, plus portions of the config.xml for the interface, VIP, and gateway configuration.

Actions #5

Updated by RUI YUAN over 3 years ago

Jim Pingle wrote in #note-4:

I tried to recreate the problem and could not. My subnet mask was always applied correctly. There must be something else in your configuration causing the problem but there is still not enough information to go on.

Again, please take this to the forum as this is not the place to diagnose your problem. When you create a forum thread, include all of the information posted here, plus portions of the config.xml for the interface, VIP, and gateway configuration.

I have found the problem by debugging, it is due to the L2TP client, in the interface_ppps_configure function

/* configure interface */
if (is_ipaddr($localips[$pid])) {
// Manually configure interface IP/subnet
pfSense_interface_setaddress($port, "{$localips[$pid]}/{$subnets[$pid]}"); // !!!!!here!!!!!
interfaces_bring_up($port);
} elseif (empty($localips[$pid])) {
$localips[$pid] = get_interface_ip($port); // try to get the interface IP from the port
}
This setting overrides the ip address of the interface, which is the crux of the problem.
I don't think the l2tp configuration should override the interface's ip address

Actions #6

Updated by Jim Pingle over 3 years ago

  • Status changed from Incomplete to Not a Bug

The primary use case for L2TP is for L3 connectivity to an ISP, not as an L2TP VPN. For those using it as an ISP auth mechanism, the settings from the L2TP client are the priority.

In this case you configured it with conflicting information, so it did what it thought was best. Neither tactic is ideal from a user perspective (interface clobbering L2TP or L2TP clobbering the interface) but allowing the L2TP settings to have priority is in line with the intended use cases for L2TP.

Actions

Also available in: Atom PDF