Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Gateway widget displaying incorrect(?) IPv6 gateway state

    Scheduled Pinned Locked Moved webGUI
    15 Posts 3 Posters 1.9k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • patient0P Offline
      patient0 @marcg
      last edited by

      @marcg said in Gateway widget displaying incorrect(?) IPv6 gateway state:

      Thanks for the response. Unfortunately, not familiar with PHP in general or the GUI code in particular.

      Oh, no no. I was talking about configuring the widget on the dashboard. There is a wrench, a minus and a plus. Pressing the wrench and then you can choose what you want to display, the gateway ip, monitor ip or both.

      Having said that, your finding is interesting. Could be that it can not get the gateway for some reason.

      M 1 Reply Last reply Reply Quote 0
      • M Offline
        marcg @patient0
        last edited by marcg

        @patient0 said in Gateway widget displaying incorrect(?) IPv6 gateway state:

        Oh, no no. I was talking about configuring the widget on the dashboard. There is a wrench, a minus and a plus. Pressing the wrench and then you can choose what you want to display, the gateway ip, monitor ip or both.

        Having said that, your finding is interesting. Could be that it can not get the gateway for some reason.

        Much easier :)

        Changing from Both to Gateway IP displays just the tilde, so the issue remains.

        9bceb505-3e2e-42f5-9988-4be3f4864b52-image.png

        No idea why it wouldn't be able to get the gateway IP. It's able to do that for the v4 interfaces and, as mentioned, the v6 gateway is up and routing.

        fb7a9a04-8a9b-49bf-9d6f-5813a9b7fe3d-image.png

        EDIT: As mentioned at the start of the thread, rebooting the upstream gateway causes the widget to display the gateway LLA and the globe icon to reappear. ifconfig shows the same LLA and GUAs after the reboot as before.

        c455f283-9385-45ff-a263-ca025d235d47-image.png

        patient0P 1 Reply Last reply Reply Quote 0
        • patient0P Offline
          patient0 @marcg
          last edited by patient0

          @marcg said in Gateway widget displaying incorrect(?) IPv6 gateway state:

          Changing from Both to Gateway IP displays just the tilde, so the issue remains.

          I guess that's a bug, now the question is how to reproduce it. PHP is not my thing either.

          get_interface_gateway_v6($gateway['friendlyiface']); is not doing it's job, I'm sure there are clever people in this forum who can help. I'll see if there is a way to manually call get_interface_gateway_v6() to see what is returned.

              105           if ($gateway['ipprotocol'] == "inet6") {
              106             $if_gw = htmlspecialchars(get_interface_gateway_v6($gateway['friendlyiface']));
              107           }
          

          The menu 12) PHP shell + Netgate pfSense Plus tools from the login menu maybe of help, providing a PHP shell, never used it though.

          M 1 Reply Last reply Reply Quote 0
          • M Offline
            marcg @patient0
            last edited by

            @patient0 said in Gateway widget displaying incorrect(?) IPv6 gateway state:

            I guess that's a bug, now the question is how to reproduce it. PHP is not my thing either.

            get_interface_gateway_v6($gateway['friendlyiface']); is not doing it's job, I'm sure there are clever people in this forum who can help. I'll see if there is a way to manually call get_interface_gateway_v6() to see what is returned.

            Guessing that the issue is a larger one with the gateway array than just the v6 address. The globe icon, indicating that the interface is the default interface, also disappears (even though the interface is active and the default, in fact the only, v6 WAN interface). The globe icon is enabled at line 78 of the widget code from the gateway array.

            Appreciate the help. This is a low priority issue for me, please spend time only if it's of interest.

            patient0P 1 Reply Last reply Reply Quote 0
            • patient0P Offline
              patient0 @marcg
              last edited by

              @marcg said in Gateway widget displaying incorrect(?) IPv6 gateway state:

              The globe icon, indicating that the interface is the default interface

              It can't get/parse any of the IPv6 info it seems, yes. I just switched WAN for one of my pfSense test instances from static to DHCP. And the ~ was there when upstream DHCP wasn't ready.

              This is a low priority issue for me, please spend time only if it's of interest.

              No worries, I won't overwork me :) ... soon done for today, but I'm interested and will have another go tomorrow.

              M 1 Reply Last reply Reply Quote 1
              • M Offline
                marcg @patient0
                last edited by marcg

                @patient0 said in Gateway widget displaying incorrect(?) IPv6 gateway state:

                It can't get/parse any of the IPv6 info it seems, yes. I just switched WAN for one of my pfSense test instances from static to DHCP. And the ~ was there when upstream DHCP wasn't ready.

                I got a bit off-track with today's ifconfig comments, apologies for any confusion. The gateway IP is instead available from netstat -r.

                As shown in the original post, netstat returns the v6 gateway IP as the default route both when the widget displays properly and when it displays improperly.

                patient0P 1 Reply Last reply Reply Quote 0
                • patient0P Offline
                  patient0 @marcg
                  last edited by

                  @marcg I had a little playtime with PHP and pfSense, taking gateways.widget.php as the starting point.

                  The following small PHP iterates through the gateways and outputs some of the fields of it. If you uncomment the // var_dump($gateway); it will output all the fields for every gateway. In my case there were two gateways (wan v4 and wan v6) with 14 entries in each gateway array:

                  <?php
                  
                  require_once("pfsense-utils.inc");
                  
                          $a_gateways = return_gateways_array();
                          foreach ($a_gateways as $gname => $gateway) {
                                  echo "gateway: ", $gateway['name'], "\n";
                                  echo "... friendly iface: ", $gateway['friendlyiface'], "\n";
                                  echo "... isdefault: '", $gateway['isdefaultgw'], "'\n";
                                  echo "... inactive: '", $gateway['inactive'], "'\n";
                                  if ($gateway['ipprotocol'] == "inet") {
                                          $if_gw = get_interface_gateway($gateway['friendlyiface']);
                                  } else {
                                          $if_gw = get_interface_gateway_v6($gateway['friendlyiface']);
                                  }
                                  echo "... get iface gateway: '", $if_gw, "'\n";
                                  // var_dump($gateway);
                          }
                  ?>
                  

                  And running it outputs the below on my test system:

                  [2.7.2-RELEASE][root@pfsense.home.arpa]/root: php justforfun.php 
                  gateway: WAN_DHCP
                  ... friendly iface: wan
                  ... isdefault: '1'
                  ... inactive: ''
                  ... get iface gateway: '10.199.200.1'
                  gateway: WAN_DHCP6
                  ... friendly iface: wan
                  ... isdefault: '1'
                  ... inactive: ''
                  ... get iface gateway: 'fe80::be24:11ff:fecf:686b%vtnet0'
                  

                  I would assume that isdefault and get iface gateway are empty for IPv6 in your case, right?

                  The PHP commands can also be run from the menu 12) PHP shell + pfSense tools.

                  As usual, don't post any public IP ranges on the forum. Mine are ULAs or private IPs, no issue here.

                  Regarding the netstat -rn output: On my prod (24.11) and in the test system (CE 2.7.2) - used above - the default gateways always have the 'S' flag set, and both get their default route per DHCP.

                  netstat man page tells me:

                  S RTF_STATIC Manually added`

                  I'm not knowledgable enough to know how you can have a default getway that is not manually added, while getting the gateway per DHCP client).

                  M 1 Reply Last reply Reply Quote 1
                  • M Offline
                    marcg @patient0
                    last edited by marcg

                    @patient0 Excellent ... thanks!

                    At the moment, the widget is correctly displaying the state (result of yesterday's reboots).

                    41275872-7ced-4c1b-96ce-33ebf93db12b-image.png

                    That's consistent with the PHP script output.

                    gateway: WAN_DHCP6
                    ... friendly iface: wan
                    ... isdefault: true
                    ... gateway status: enabled
                    ... get iface gateway: 'fe80::be9a:8eff:fe0b:3b81%igc0'
                    gateway: WAN_DHCP
                    ... friendly iface: wan
                    ... isdefault: true
                    ... gateway status: enabled
                    ... get iface gateway: a.b.c.d
                    gateway: E1V95_LTEGW
                    ... friendly iface: opt12
                    ... isdefault: false
                    ... gateway status: enabled
                    ... get iface gateway: '192.168.95.1'
                    

                    It's also consistent with netstat.

                    [24.11-RELEASE][admin@pfSense.home.arpa]/root: netstat -rn | grep default
                    default            a.b.c.d                                         UGS           igc0
                    default            fe80::be9a:8eff:fe0b:3b81%igc0                  UGS           igc0
                    

                    I'll run the script again and post the results when I next see the failure.

                    I made small changes to the script to handle different gateway statuses and missing addresses. The WAN_DHCP and E1V95_LTEGW interfaces on my system are set up as a gateway group -- IPv4 failover -- so it's normal for one of them not to be the default gateway.

                    require_once("pfsense-utils.inc");
                    
                    $a_gateways = return_gateways_array();
                    foreach ($a_gateways as $gname => $gateway) {
                        echo "gateway: ", $gateway['name'], "\n";
                        echo "... friendly iface: ", $gateway['friendlyiface'], "\n";
                        echo "... isdefault: ";
                        if (isset($gateway['isdefaultgw'])) {
                             echo "true\n";
                        } else {
                             echo "false\n";
                        }
                        echo "... gateway status: ";
                        if (isset($gateway['inactive'])) {
                            echo "inactive\n";
                        } elseif  (isset($gateway['disabled'])) {
                            echo "disabled\n";
                        } else {
                            echo "enabled\n";
                        }
                        $if_gw = '';
                        if ($gateway['ipprotocol'] == "inet") {
                            $if_gw = get_interface_gateway($gateway['friendlyiface']);
                        } else {
                            $if_gw = get_interface_gateway_v6($gateway['friendlyiface']);
                        }
                        echo "... get iface gateway: '", $if_gw, "'\n";
                        //var_dump($gateway);
                    }
                    
                    1 Reply Last reply Reply Quote 0
                    • M Offline
                      marcg
                      last edited by marcg

                      [filed as https://redmine.pfsense.org/issues/16163]

                      After a ~month of correctly displaying the v6 gateway state, a reboot of pfSense again causes the widget to incorrectly display the state. WAN_DHCP6 is the active v6 gateway, however the gateway address shows as a ~ and the default gateway globe icon does not appear.

                      Runnining 24.11 + System_Patches 2.2.20_4 as before.

                      7f713db0-e55f-4dc7-bb14-3096663fdbe4-image.png

                      Output from previous post's script is consistent with widget display.

                      gateway: WAN_DHCP6
                      ... friendly iface: wan
                      ... isdefault: false
                      ... gateway status: enabled
                      ... get iface gateway: ''
                      gateway: WAN_DHCP
                      ... friendly iface: wan
                      ... isdefault: true
                      ... gateway status: enabled
                      ... get iface gateway: '99.121.58.1'
                      gateway: E1V95_LTEGW
                      ... friendly iface: opt12
                      ... isdefault: false
                      ... gateway status: enabled
                      ... get iface gateway: '192.168.95.1'
                      

                      netstat -rn output differs from the case where the widget correctly displays the output in that the "S" flag for the v6 gateway does not appear.

                      [24.11-RELEASE][admin@pfSense.home.arpa]/root: netstat -rn | grep default
                      default            a.b.c.d                          UGS            igc0
                      default            fe80::be9a:8eff:fe0b:3b81%igc0   UG             igc0
                      

                      System>Routing>Gateways appears as follows.

                      1b3f964f-028b-4a9a-8a17-87b2c07ff75c-image.png

                      1 Reply Last reply Reply Quote 0
                      • M Offline
                        marcosm Netgate
                        last edited by

                        WRT the comment on redmine:

                        Aug 18 14:54:41 dpinger 89129 WAN_DHCP6 26xx:... sendto error: 13

                        The gateway status "dynamic" and the "sendto" error indicates that the system does not have a route to the monitoring address because the link-local gateway route is not available at that time. The "S" flag indeed means it's a static route which indicates the route came from pfSense itself rather than from some kernel process.

                        Normally pfSense will receive an RA indicating that a DHCP server is available and that kicks off the whole process. However some ISPs are "special". Do you have "Do not wait for a RA" checked? If not, it may be worth testing with it checked. Also pay close attention to both the system logs and DHCP logs around the time the issue happens. It helps to enable DHCP6 Debug under System > Advanced > Networking. Additionally the "ifconfig" output for the interface before and after the issue can be helpful.

                        M 1 Reply Last reply Reply Quote 0
                        • M Offline
                          marcg @marcosm
                          last edited by

                          @marcosm Thanks for the info.

                          "Do not wait for a RA" was not checked. I checked it, enabled DHCP6 Debug, and rebooted the system. I'll watch for a recurrence of the behavior reported here.

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post
                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.