Commit 1e06a53d authored by Mikio Hara's avatar Mikio Hara Committed by Brad Fitzpatrick

route: fix TestRouteMessage

We need to be careful once we opened the door to the routing facilities
inside the kernel. Also realigns the query parameters for clarification.

Fixes golang/go#29348.

Change-Id: I3e3379a85e9690a0ad5427ce75503db0795cfb7e
Reviewed-on: https://go-review.googlesource.com/c/155197
Run-TryBot: Mikio Hara <mikioh.public.networking@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarMatt Layher <mdlayher@gmail.com>
parent 395948e2
...@@ -162,20 +162,20 @@ func TestRouteMessage(t *testing.T) { ...@@ -162,20 +162,20 @@ func TestRouteMessage(t *testing.T) {
{ {
Type: sysRTM_GET, Type: sysRTM_GET,
Addrs: []Addr{ Addrs: []Addr{
&Inet4Addr{IP: [4]byte{127, 0, 0, 1}}, sysRTAX_DST: &Inet4Addr{IP: [4]byte{127, 0, 0, 1}},
nil, sysRTAX_GATEWAY: nil,
nil, sysRTAX_NETMASK: nil,
nil, sysRTAX_GENMASK: nil,
&LinkAddr{}, sysRTAX_IFP: &LinkAddr{},
&Inet4Addr{}, sysRTAX_IFA: &Inet4Addr{},
nil, sysRTAX_AUTHOR: nil,
&Inet4Addr{}, sysRTAX_BRD: &Inet4Addr{},
}, },
}, },
{ {
Type: sysRTM_GET, Type: sysRTM_GET,
Addrs: []Addr{ Addrs: []Addr{
&Inet4Addr{IP: [4]byte{127, 0, 0, 1}}, sysRTAX_DST: &Inet4Addr{IP: [4]byte{127, 0, 0, 1}},
}, },
}, },
}...) }...)
...@@ -184,20 +184,20 @@ func TestRouteMessage(t *testing.T) { ...@@ -184,20 +184,20 @@ func TestRouteMessage(t *testing.T) {
{ {
Type: sysRTM_GET, Type: sysRTM_GET,
Addrs: []Addr{ Addrs: []Addr{
&Inet6Addr{IP: [16]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}}, sysRTAX_DST: &Inet6Addr{IP: [16]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}},
nil, sysRTAX_GATEWAY: nil,
nil, sysRTAX_NETMASK: nil,
nil, sysRTAX_GENMASK: nil,
&LinkAddr{}, sysRTAX_IFP: &LinkAddr{},
&Inet6Addr{}, sysRTAX_IFA: &Inet6Addr{},
nil, sysRTAX_AUTHOR: nil,
&Inet6Addr{}, sysRTAX_BRD: &Inet6Addr{},
}, },
}, },
{ {
Type: sysRTM_GET, Type: sysRTM_GET,
Addrs: []Addr{ Addrs: []Addr{
&Inet6Addr{IP: [16]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}}, sysRTAX_DST: &Inet6Addr{IP: [16]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}},
}, },
}, },
}...) }...)
...@@ -223,9 +223,8 @@ func TestRouteMessage(t *testing.T) { ...@@ -223,9 +223,8 @@ func TestRouteMessage(t *testing.T) {
t.Fatalf("%v: %v", m, err) t.Fatalf("%v: %v", m, err)
} }
for _, rm := range rms { for _, rm := range rms {
err := rm.(*RouteMessage).Err if rm, ok := rm.(*RouteMessage); ok && rm.Err != nil {
if err != nil { t.Errorf("%v: %v", m, rm.Err)
t.Errorf("%v: %v", m, err)
} }
} }
ss, err := msgs(rms).validate() ss, err := msgs(rms).validate()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment