blob: fa729b14fb9214e94791dc6bfdf0f84e03a51cc5 [file] [log] [blame]
Kevin Cernekee95d4ae92016-06-19 10:26:29 -07001// 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 Cernekee4e62cc12016-12-03 11:50:53 -080012#include "arc-networkd/options.h"
Kevin Cernekee95d4ae92016-06-19 10:26:29 -070013
14int 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 Cernekee4e62cc12016-12-03 11:50:53 -080029 arc_networkd::Options opt;
Kevin Cernekee95d4ae92016-06-19 10:26:29 -070030 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}