Kevin Cernekee | 95d4ae9 | 2016-06-19 10:26:29 -0700 | [diff] [blame] | 1 | // Copyright 2016 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include <unistd.h> |
| 6 | |
| 7 | #include <base/logging.h> |
| 8 | #include <brillo/flag_helper.h> |
| 9 | #include <brillo/syslog_logging.h> |
| 10 | |
| 11 | #include "arc-networkd/manager.h" |
Kevin Cernekee | 4e62cc1 | 2016-12-03 11:50:53 -0800 | [diff] [blame^] | 12 | #include "arc-networkd/options.h" |
Kevin Cernekee | 95d4ae9 | 2016-06-19 10:26:29 -0700 | [diff] [blame] | 13 | |
| 14 | int main(int argc, char* argv[]) { |
| 15 | DEFINE_bool(log_to_stderr, false, "Log to both syslog and stderr"); |
| 16 | DEFINE_string(internal_interface, "br0", |
| 17 | "Name of the host interface that connects to the guest"); |
| 18 | DEFINE_string(container_interface, "arc0", |
| 19 | "Name of the guest interface that connects to the host"); |
| 20 | DEFINE_int32(con_netns, 0, "Container's network namespace (PID)"); |
| 21 | |
| 22 | brillo::FlagHelper::Init(argc, argv, "ARC network daemon"); |
| 23 | |
| 24 | int flags = brillo::kLogToSyslog | brillo::kLogHeader; |
| 25 | if (FLAGS_log_to_stderr) |
| 26 | flags |= brillo::kLogToStderr; |
| 27 | brillo::InitLog(flags); |
| 28 | |
Kevin Cernekee | 4e62cc1 | 2016-12-03 11:50:53 -0800 | [diff] [blame^] | 29 | arc_networkd::Options opt; |
Kevin Cernekee | 95d4ae9 | 2016-06-19 10:26:29 -0700 | [diff] [blame] | 30 | opt.int_ifname = FLAGS_internal_interface; |
| 31 | opt.con_ifname = FLAGS_container_interface; |
| 32 | opt.con_netns = FLAGS_con_netns; |
| 33 | |
| 34 | arc_networkd::Manager manager{opt}; |
| 35 | return manager.Run(); |
| 36 | } |