]> git.proxmox.com Git - mirror_iproute2.git/commit - ip/ipnexthop.c
Add support for nexthop objects
authorDavid Ahern <dsahern@gmail.com>
Fri, 7 Jun 2019 22:38:13 +0000 (15:38 -0700)
committerDavid Ahern <dsahern@gmail.com>
Tue, 11 Jun 2019 17:30:58 +0000 (10:30 -0700)
commit63df8e8543b03cfadfaacbd46025f8479f9ff328
tree12c03dba8226b5a7900427e50b11cda308918254
parent48a1e96d908572fd165231fd771f59a05fc64f71
Add support for nexthop objects

Add nexthop subcommand to ip. Implement basic commands for creating,
deleting and dumping nexthop objects. Syntax follows 'nexthop' syntax
from existing 'ip route' command.

Examples:
1. Single path
    $ ip nexthop add id 1 via 10.99.1.2 dev veth1
    $ ip nexthop ls
    id 1 via 10.99.1.2 src 10.99.1.1 dev veth1 scope link

2. ECMP
    $ ip nexthop add id 2 via 10.99.3.2 dev veth3
    $ ip nexthop add id 1001 group 1/2
      --> creates a nexthop group with 2 component nexthops:
          id 1 and id 2 both the same weight

    $ ip nexthop ls
    id 1 via 10.99.1.2 src 10.99.1.1 dev veth1 scope link
    id 2 via 10.99.3.2 src 10.99.3.1 dev veth3 scope link
    id 1001 group 1/2

3. Weighted multipath
    $ ip nexthop add id 1002 group 1,10/2,20
      --> creates a nexthop group with 2 component nexthops:
          id 1 with a weight of 10 and id 2 with a weight of 20

    $ ip nexthop ls
    id 1 via 10.99.1.2 src 10.99.1.1 dev veth1 scope link
    id 2 via 10.99.3.2 src 10.99.3.1 dev veth3 scope link
    id 1001 group 1/2
    id 1002 group 1,10/2,20

Signed-off-by: David Ahern <dsahern@gmail.com>
ip/Makefile
ip/ip.c
ip/ip_common.h
ip/ipnexthop.c [new file with mode: 0644]