mirror of
https://github.com/vishvananda/netlink.git
synced 2025-09-27 04:05:59 +08:00
support MPLS
$ ip -M route add 100 dev eth0 $ ip -M route add 100 as to 200/300 dev eth0 $ ip -M route add 100 nexthop dev eth0 as to 200 \ nexthop dev eth1 as to 300 $ ip route add 10.10.0.0/24 encap mpls 200/300 dev eth0 $ ip route add 10.0.0.0/24 nexthop encap mpls 200 dev eth0 \ nexthop encap mpls 300 dev eth1 Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
This commit is contained in:

committed by
Vish Ishaya

parent
dedc638a06
commit
fe3b5664d2
@@ -36,3 +36,23 @@ func setUpNetlinkTest(t *testing.T) tearDownNetlinkTest {
|
||||
runtime.UnlockOSThread()
|
||||
}
|
||||
}
|
||||
|
||||
func setUpMPLSNetlinkTest(t *testing.T) tearDownNetlinkTest {
|
||||
if _, err := os.Stat("/proc/sys/net/mpls/platform_labels"); err != nil {
|
||||
msg := "Skipped test because it requires MPLS support."
|
||||
log.Printf(msg)
|
||||
t.Skip(msg)
|
||||
}
|
||||
f := setUpNetlinkTest(t)
|
||||
setUpF := func(path, value string) {
|
||||
file, err := os.Create(path)
|
||||
defer file.Close()
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to open %s: %s", path, err)
|
||||
}
|
||||
file.WriteString(value)
|
||||
}
|
||||
setUpF("/proc/sys/net/mpls/platform_labels", "1024")
|
||||
setUpF("/proc/sys/net/mpls/conf/lo/input", "1")
|
||||
return f
|
||||
}
|
||||
|
Reference in New Issue
Block a user