2020-04-04 08:19:30 -03:00
|
|
|
/*
|
2021-04-28 17:46:44 -03:00
|
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
2020-04-04 08:19:30 -03:00
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-04-04 08:19:30 -03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "DHCPv4Client.h"
|
|
|
|
|
#include <AK/JsonArray.h>
|
|
|
|
|
#include <AK/JsonObject.h>
|
|
|
|
|
#include <LibCore/EventLoop.h>
|
|
|
|
|
#include <LibCore/LocalServer.h>
|
|
|
|
|
#include <stdio.h>
|
2021-03-12 13:29:37 -03:00
|
|
|
#include <unistd.h>
|
2020-04-04 08:19:30 -03:00
|
|
|
|
2020-12-20 20:09:48 -03:00
|
|
|
int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv)
|
2020-04-04 08:19:30 -03:00
|
|
|
{
|
2021-05-13 18:20:26 -03:00
|
|
|
if (pledge("stdio unix inet cpath rpath", nullptr) < 0) {
|
2020-04-04 08:19:30 -03:00
|
|
|
perror("pledge");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Core::EventLoop event_loop;
|
|
|
|
|
|
|
|
|
|
if (unveil("/proc/net/", "r") < 0) {
|
|
|
|
|
perror("unveil");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unveil(nullptr, nullptr);
|
|
|
|
|
|
2021-05-26 02:26:07 -03:00
|
|
|
auto client = DHCPv4Client::construct();
|
2020-04-04 08:19:30 -03:00
|
|
|
|
2021-05-13 18:20:26 -03:00
|
|
|
if (pledge("stdio inet cpath rpath", nullptr) < 0) {
|
2020-04-04 08:19:30 -03:00
|
|
|
perror("pledge");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return event_loop.exec();
|
|
|
|
|
}
|