Skip to content

Commit

Permalink
Merge pull request containers#18774 from dgibson/bad-default-protocol
Browse files Browse the repository at this point in the history
pasta: Correct handling of unknown protocols
  • Loading branch information
openshift-merge-robot authored Jun 5, 2023
2 parents 18eb74f + cf9bc25 commit e143a0f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libpod/networking_pasta_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
8 changes: 8 additions & 0 deletions test/system/505-networking-pasta.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit e143a0f

Please sign in to comment.