Modify

Opened 10 years ago

Closed 6 years ago

#2987 closed enhancement (fixed)

Static route setup for non-static interfaces

Reported by: igor.milavec@… Owned by: developers
Priority: normal Milestone: Features Paradise
Component: packages Version: Kamikaze trunk
Keywords: config route network pppoe dhcp Cc:

Description

Hi.

When specifying a static route through non-static (PPPOE, DHCP) interfaces, you may not know the gateway in advance. That's why I propose to implement the "option gateway auto" for the route config section.

Here are the required changes to /etc/hotplug.d/iface/10-routes:

       # make sure there is a gateway and a target
       [ -n "$target" ] || {
               echo "Missing target in route section $config"
               return 1
       }
+      [ "$gateway" = "auto" ] && {
+              # Get the gateway from the interface configuration
+              config_get gateway "$interface" gateway
+      }
       [ -n "$gateway" ] || {
               echo "Missing gateway in route section $config"
               return 1
       }

Also, /etc/ppp/ip-up needs to be changed:

  - [ -z "$PPP_IPPARAM" ] || env -i ACTION="ifup" INTERFACE="$PPP_IPPARAM" DEVICE="$PPP_IFACE" PROTO=ppp /sbin/hotplug-call "iface"
    [ -z "$PPP_IPPARAM" -o -z "$PPP_LOCAL" ] || {
            uci set "/var/state/network.$PPP_IPPARAM.ipaddr=$PPP_LOCAL"
            uci set "/var/state/network.$PPP_IPPARAM.gateway=$PPP_REMOTE"
    }
  + [ -z "$PPP_IPPARAM" ] || env -i ACTION="ifup" INTERFACE="$PPP_IPPARAM" DEVICE="$PPP_IFACE" PROTO=ppp /sbin/hotplug-call "iface"

Regards, Igor

Attachments (2)

10-routes (1.4 KB) - added by igor.milavec@… 10 years ago.
ip-up (647 bytes) - added by igor.milavec@… 10 years ago.

Download all attachments as: .zip

Change History (4)

Changed 10 years ago by igor.milavec@…

Changed 10 years ago by igor.milavec@…

comment:1 Changed 8 years ago by spudz76

  • Milestone set to Kamikaze Features Paradize
  • Version set to Kamikaze trunk

[patchteam] Bumping this to features and leaving open and unassigned at normal priority, pending review to see if it is still applicable - not sure it's obsolete, and seems like a useful enhancement.

comment:2 Changed 6 years ago by nbd

  • Resolution set to fixed
  • Status changed from new to closed

fixed with netifd

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.