@@ -70,7 +70,7 @@ struct ConsoleArgs {
7070 /// Initial tcp port to be used with `network` backend. If socket_count is
7171 /// `N` then the following tcp ports will be created: `tcp_port`,
7272 /// `tcp_port + 1`, ... , `tcp_port + (N - 1)`.
73- #[ clap( short = 'p' , long, value_name = "PORT" , default_value = "12345" ) ]
73+ #[ clap( short = 'p' , long, value_name = "PORT" ) ]
7474 tcp_port : String ,
7575
7676 /// Specify the maximum size of virtqueue, the default is 128.
@@ -86,8 +86,22 @@ impl TryFrom<ConsoleArgs> for VuConsoleConfig {
8686 return Err ( Error :: SocketCountInvalid ( 0 ) ) ;
8787 }
8888
89- if ( args. backend == BackendType :: Nested ) && ( args. socket_count != 1 ) {
90- return Err ( Error :: WrongBackendSocket ) ;
89+ if args. backend == BackendType :: Nested {
90+ if args. socket_count != 1 {
91+ return Err ( Error :: WrongBackendSocket ) ;
92+ }
93+
94+ if ( !args. tcp_port . is_empty ( ) ) || ( args. uds_path . is_some ( ) ) {
95+ return Err ( Error :: InvalidCmdlineOption ) ;
96+ }
97+ }
98+
99+ if args. backend == BackendType :: Network && args. uds_path . is_some ( ) {
100+ return Err ( Error :: InvalidCmdlineOption ) ;
101+ }
102+
103+ if args. backend == BackendType :: Uds && !args. tcp_port . is_empty ( ) {
104+ return Err ( Error :: InvalidCmdlineOption ) ;
91105 }
92106
93107 let ConsoleArgs {
0 commit comments