2019-09-20 18:21:54 +00:00
|
|
|
// Copyright 2019 Intel Corporation. All Rights Reserved.
|
|
|
|
//
|
|
|
|
// Portions Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
|
|
//
|
|
|
|
// Portions Copyright 2017 The Chromium OS Authors. All rights reserved.
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: (Apache-2.0 AND BSD-3-Clause)
|
|
|
|
|
2023-01-12 15:53:51 +00:00
|
|
|
use argh::FromArgs;
|
2020-01-21 15:16:38 +00:00
|
|
|
use vhost_user_net::start_net_backend;
|
2019-09-20 18:21:54 +00:00
|
|
|
|
2023-01-12 15:53:51 +00:00
|
|
|
#[derive(FromArgs)]
|
|
|
|
/// Launch a vhost-user-net backend.
|
|
|
|
struct TopLevel {
|
|
|
|
#[argh(option, long = "net-backend")]
|
|
|
|
/// vhost-user-net backend parameters
|
|
|
|
/// ip=<ip_addr>,mask=<net_mask>,socket=<socket_path>,client=on|off,num_queues=<number_of_queues>,queue_size=<size_of_each_queue>,tap=<if_name>
|
|
|
|
backend_command: String,
|
|
|
|
}
|
|
|
|
|
2019-09-20 18:21:54 +00:00
|
|
|
fn main() {
|
2021-08-04 19:35:56 +00:00
|
|
|
env_logger::init();
|
|
|
|
|
2023-01-12 15:53:51 +00:00
|
|
|
let toplevel: TopLevel = argh::from_env();
|
2019-09-20 18:21:54 +00:00
|
|
|
|
2023-01-12 15:53:51 +00:00
|
|
|
start_net_backend(&toplevel.backend_command);
|
2019-09-20 18:21:54 +00:00
|
|
|
}
|