mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add a diagnostic message to ip forwading code
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
This commit is contained in:
parent
8305579ffc
commit
58a3934282
2 changed files with 10 additions and 2 deletions
|
@ -15,6 +15,11 @@ func SetupIPForwarding(i *Interface) error {
|
|||
if i.Config.EnableIPForwarding == false {
|
||||
return fmt.Errorf("Unexpected request to enable IP Forwarding for: %v", *i)
|
||||
}
|
||||
|
||||
// Enable IPv4 forwarding
|
||||
return ioutil.WriteFile(IPV4_FORW_CONF_FILE, []byte{'1', '\n'}, PERM)
|
||||
if err := ioutil.WriteFile(IPV4_FORW_CONF_FILE, []byte{'1', '\n'}, PERM); err != nil {
|
||||
return fmt.Errorf("Setup IP forwarding failed: %v", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package bridge
|
|||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
@ -51,7 +52,9 @@ func TestUnexpectedSetupIPForwarding(t *testing.T) {
|
|||
|
||||
// Attempt Set IP Forwarding
|
||||
if err := SetupIPForwarding(br); err == nil {
|
||||
t.Fatalf(err.Error())
|
||||
t.Fatal("Setup IP forwarding was expected to fail")
|
||||
} else if !strings.Contains(err.Error(), "Unexpected request") {
|
||||
t.Fatalf("Setup IP forwarding failed with unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue