Skip to content

Add support for scope and src route options #683

Description

@jjbc

Could it be possible to add support for scope and src parameters in the route definitions?

An example of route with these parameters in a .nmconnection file:

route3_options=scope=253,src=192.168.12.154,table=200

An implementation approach could be:

In the network_connections.py, add the two new parameters to the NM.IPRoute creation:

      for r in ip["route"]:
          new_route = NM.IPRoute.new(
              r["family"], r["network"], r["prefix"], r["gateway"], r["metric"]
          )
          if r["type"]:
              NM.IPRoute.set_attribute(
                  new_route, "type", Util.GLib().Variant("s", r["type"])
              )
          if r["scope"]:
              NM.IPRoute.set_attribute(
                  new_route, "scope", Util.GLib().Variant.new_byte(r["scope"])
              )
          if r["src"]:
              NM.IPRoute.set_attribute(
                  new_route, "src", Util.GLib().Variant.new_string(r["src"])
              )
          if r["table"]:
              NM.IPRoute.set_attribute(
                  new_route, "table", Util.GLib().Variant.new_uint32(r["table"])
              )

In the argument_validator.py, validate these options inside ArgValidatorIPRoute class:

               ArgValidatorIP(
                    "src", family=family, default_value=None, plain_address=False
                ),
                ArgValidatorNum("scope", default_value=None, val_min=0, val_max=255),

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedPossible issue for newcomers

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions