Initialize registers in test
Recent kernels disallow reads from uninitialized registers, which breaks
this test.
See 14fb07130c
This commit is contained in:
parent
0420ffbf57
commit
594585af33
|
@ -622,6 +622,14 @@ func TestMasqMarshalUnmarshal(t *testing.T) {
|
||||||
Table: filter,
|
Table: filter,
|
||||||
Chain: postrouting,
|
Chain: postrouting,
|
||||||
Exprs: []expr.Any{
|
Exprs: []expr.Any{
|
||||||
|
&expr.Immediate{
|
||||||
|
Register: min,
|
||||||
|
Data: binaryutil.BigEndian.PutUint16(4070),
|
||||||
|
},
|
||||||
|
&expr.Immediate{
|
||||||
|
Register: max,
|
||||||
|
Data: binaryutil.BigEndian.PutUint16(4090),
|
||||||
|
},
|
||||||
&expr.Masq{
|
&expr.Masq{
|
||||||
ToPorts: true,
|
ToPorts: true,
|
||||||
RegProtoMin: min,
|
RegProtoMin: min,
|
||||||
|
@ -652,13 +660,13 @@ func TestMasqMarshalUnmarshal(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
rule := rules[0]
|
rule := rules[0]
|
||||||
if got, want := len(rule.Exprs), 1; got != want {
|
if got, want := len(rule.Exprs), 3; got != want {
|
||||||
t.Fatalf("unexpected number of exprs: got %d, want %d", got, want)
|
t.Fatalf("unexpected number of exprs: got %d, want %d", got, want)
|
||||||
}
|
}
|
||||||
|
|
||||||
me, ok := rule.Exprs[0].(*expr.Masq)
|
me, ok := rule.Exprs[2].(*expr.Masq)
|
||||||
if !ok {
|
if !ok {
|
||||||
t.Fatalf("unexpected expression type: got %T, want *expr.Masq", rule.Exprs[0])
|
t.Fatalf("unexpected expression type: got %T, want *expr.Masq", rule.Exprs[2])
|
||||||
}
|
}
|
||||||
|
|
||||||
if got, want := me.ToPorts, true; got != want {
|
if got, want := me.ToPorts, true; got != want {
|
||||||
|
|
Loading…
Reference in New Issue