Skip to content

Commit

Permalink
port/builtin: return proper error for sctp
Browse files Browse the repository at this point in the history
When trying to forward sctp port we get a useless
"rootlessport spec was not validated" error back even though the spec
was validated before. It is not clear to me if other drivers support
sctp here so I didn't want to change ValidatePortSpec to disallow sctp.

As such simply return a useful error saying the protocol is not
supported.

Signed-off-by: Paul Holzinger <[email protected]>
  • Loading branch information
Luap99 committed Sep 18, 2024
1 parent 264f23e commit f11b0e6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/port/builtin/parent/parent.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ func (d *driver) AddPort(ctx context.Context, spec port.Spec) (*port.Status, err
case "udp", "udp4", "udp6":
err = udp.Run(d.socketPath, spec, routineStopCh, routineStoppedCh, d.logWriter)
default:
// NOTREACHED
return nil, errors.New("spec was not validated?")
return nil, fmt.Errorf("unsupported port protocol %s", spec.Proto)
}
if err != nil {
if isEPERM(err) {
Expand Down

0 comments on commit f11b0e6

Please sign in to comment.