Skip to content

Commit 7c837c6

Browse files
author
Feng Wang
committed
move the fix to the service side
1 parent 65c3da8 commit 7c837c6

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/windows/wslc/tasks/NetworkTasks.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ void CreateNetwork(CLIExecutionContext& context)
8686
options.Labels.push_back(validation::ParseLabel(label));
8787
}
8888

89-
options.Driver = context.Args.Contains(ArgType::Driver) ? WideToMultiByte(context.Args.Get<ArgType::Driver>()) : "bridge";
89+
if (context.Args.Contains(ArgType::Driver))
90+
{
91+
options.Driver = WideToMultiByte(context.Args.Get<ArgType::Driver>());
92+
}
9093

9194
NetworkService::Create(context.Data.Get<Data::Session>(), options);
9295
PrintMessage(MultiByteToWide(options.Name));

src/windows/wslcsession/WSLCSession.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2285,10 +2285,9 @@ try
22852285

22862286
RETURN_HR_IF_NULL(E_POINTER, Options);
22872287
RETURN_HR_IF_NULL(E_POINTER, Options->Name);
2288-
RETURN_HR_IF_NULL(E_POINTER, Options->Driver);
22892288

22902289
std::string name = Options->Name;
2291-
std::string driver = Options->Driver;
2290+
std::string driver = (Options->Driver != nullptr && Options->Driver[0] != '\0') ? Options->Driver : WSLCBridgeNetworkDriver;
22922291

22932292
ValidateName(name.c_str(), WSLC_MAX_NETWORK_NAME_LENGTH);
22942293

0 commit comments

Comments
 (0)