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) {
{
Type: sysRTM_GET,
Addrs: []Addr{
&Inet4Addr{IP: [4]byte{127, 0, 0, 1}},
nil,
nil,
nil,
&LinkAddr{},
&Inet4Addr{},
nil,
&Inet4Addr{},
sysRTAX_DST: &Inet4Addr{IP: [4]byte{127, 0, 0, 1}},
sysRTAX_GATEWAY: nil,
sysRTAX_NETMASK: nil,
sysRTAX_GENMASK: nil,
sysRTAX_IFP: &LinkAddr{},
sysRTAX_IFA: &Inet4Addr{},
sysRTAX_AUTHOR: nil,
sysRTAX_BRD: &Inet4Addr{},
},
},
{
Type: sysRTM_GET,
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) {
{
Type: sysRTM_GET,
Addrs: []Addr{
&Inet6Addr{IP: [16]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}},
nil,
nil,
nil,
&LinkAddr{},
&Inet6Addr{},
nil,
&Inet6Addr{},
sysRTAX_DST: &Inet6Addr{IP: [16]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}},
sysRTAX_GATEWAY: nil,
sysRTAX_NETMASK: nil,
sysRTAX_GENMASK: nil,
sysRTAX_IFP: &LinkAddr{},
sysRTAX_IFA: &Inet6Addr{},
sysRTAX_AUTHOR: nil,
sysRTAX_BRD: &Inet6Addr{},
},
},
{
Type: sysRTM_GET,
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) {
t.Fatalf("%v: %v", m, err)
}
for _, rm := range rms {
err := rm.(*RouteMessage).Err
if err != nil {
t.Errorf("%v: %v", m, err)
if rm, ok := rm.(*RouteMessage); ok && rm.Err != nil {
t.Errorf("%v: %v", m, rm.Err)
}
}
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