Merge pull request #18774 from dgibson/bad-default-protocol

pasta: Correct handling of unknown protocols
This commit is contained in:
OpenShift Merge Robot
2023-06-05 10:40:00 -04:00
committed by GitHub
2 changed files with 9 additions and 1 deletions

View File

@ -48,7 +48,7 @@ func (r *Runtime) setupPasta(ctr *Container, netns string) error {
cmdArgs = append(cmdArgs, "-t")
case "udp":
cmdArgs = append(cmdArgs, "-u")
case "default":
default:
return fmt.Errorf("can't forward protocol: %s", protocol)
}

View File

@ -681,3 +681,11 @@ function teardown() {
sleep 1
! ps -p $(cat "${pidfile}") && rm "${pidfile}"
}
### Options ####################################################################
@test "podman networking with pasta(1) - Unsupported protocol in port forwarding" {
local port=$(random_free_port "" "" tcp)
run_podman 126 run --net=pasta -p "${port}:${port}/sctp" $IMAGE true
is "$output" "Error: .*can't forward protocol: sctp"
}