forked from containers/podman
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
podman containers using IPv6 were missing the default route, breaking deployments trying to use them. The problem is that the default route was hardcoded to IPv4, this takes into consideration the podman subnet IP family to generate the corresponding default route. Signed-off-by: Antonio Ojea <[email protected]>
- Loading branch information
Antonio Ojea
committed
Aug 15, 2020
1 parent
d777a7b
commit 07e3f1b
Showing
5 changed files
with
97 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package network | ||
|
||
import ( | ||
"reflect" | ||
"testing" | ||
) | ||
|
||
func TestNewIPAMDefaultRoute(t *testing.T) { | ||
|
||
tests := []struct { | ||
name string | ||
isIPv6 bool | ||
want IPAMRoute | ||
}{ | ||
{ | ||
name: "IPv4 default route", | ||
isIPv6: false, | ||
want: IPAMRoute{defaultIPv4Route}, | ||
}, | ||
{ | ||
name: "IPv6 default route", | ||
isIPv6: true, | ||
want: IPAMRoute{defaultIPv6Route}, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
tt := tt | ||
t.Run(tt.name, func(t *testing.T) { | ||
got, err := NewIPAMDefaultRoute(tt.isIPv6) | ||
if err != nil { | ||
t.Errorf("no errorr expected: %v", err) | ||
} | ||
if !reflect.DeepEqual(got, tt.want) { | ||
t.Errorf("NewIPAMDefaultRoute() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters