diff options
| author | David Lönnhager <david.l@mullvad.net> | 2021-11-23 15:30:53 +0100 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2021-11-23 15:30:53 +0100 |
| commit | 3a78f67b38eaedcaee223dbd2f24eaec986e69b2 (patch) | |
| tree | 409d2b4605ac2ac006d4048b5c73caac697397cb | |
| parent | 6c84f7e5dccdacc98e8e67d0380e4aaf7e321df5 (diff) | |
| parent | a12ff0da9c683f8762b033bf5347a885ea2e90ec (diff) | |
| download | mullvadvpn-3a78f67b38eaedcaee223dbd2f24eaec986e69b2.tar.xz mullvadvpn-3a78f67b38eaedcaee223dbd2f24eaec986e69b2.zip | |
Merge branch 'fix-relay-cli'
| -rw-r--r-- | mullvad-cli/src/cmds/relay.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/mullvad-cli/src/cmds/relay.rs b/mullvad-cli/src/cmds/relay.rs index 20f50a9a07..7c438e89f3 100644 --- a/mullvad-cli/src/cmds/relay.rs +++ b/mullvad-cli/src/cmds/relay.rs @@ -638,7 +638,7 @@ impl Relay { .relay_settings .unwrap(); - print!( + println!( "Current constraints: {}", RelaySettings::try_from(relay_settings).unwrap() ); @@ -792,16 +792,25 @@ fn parse_transport_port( } } }; - let port = match matches.value_of("port") { + let mut port = match matches.value_of("port") { Some(port) => parse_port_constraint(port)?, None => { if let Some(ref transport_port) = current_constraint { - Constraint::Only(transport_port.port as u16) + if transport_port.port != 0 { + Constraint::Only(transport_port.port as u16) + } else { + Constraint::Any + } } else { Constraint::Any } } }; + if port.is_only() && protocol.is_any() && !matches.is_present("port") { + // Reset the port if the transport protocol is set to any. + println!("The port constraint was set to 'any'"); + port = Constraint::Any; + } match (port, protocol) { (Constraint::Any, Constraint::Any) => Ok(None), (Constraint::Any, Constraint::Only(protocol)) => Ok(Some(types::TransportPort { |
