mirror of
https://github.com/systemd/systemd.git
synced 2024-11-12 15:21:19 +03:00
4f5f911e81
When handing out DHCP leases, try to propagate DNS/NTP server information from "uplink". The "uplink" is automatically determined as the network interface with the highest priority default route on it.
92 lines
2.4 KiB
C
92 lines
2.4 KiB
C
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
|
|
|
/***
|
|
This file is part of systemd.
|
|
|
|
Copyright 2013 Tom Gundersen <teg@jklm.no>
|
|
|
|
systemd is free software; you can redistribute it and/or modify it
|
|
under the terms of the GNU Lesser General Public License as published by
|
|
the Free Software Foundation; either version 2.1 of the License, or
|
|
(at your option) any later version.
|
|
|
|
systemd is distributed in the hope that it will be useful, but
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
|
***/
|
|
|
|
#pragma once
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
#include "sd-event.h"
|
|
#include "sd-netlink.h"
|
|
#include "sd-bus.h"
|
|
#include "udev.h"
|
|
|
|
#include "hashmap.h"
|
|
#include "list.h"
|
|
|
|
typedef struct Manager Manager;
|
|
|
|
#include "networkd-network.h"
|
|
#include "networkd-address-pool.h"
|
|
#include "networkd-link.h"
|
|
#include "networkd-util.h"
|
|
|
|
struct Manager {
|
|
sd_netlink *rtnl;
|
|
sd_event *event;
|
|
sd_event_source *bus_retry_event_source;
|
|
sd_bus *bus;
|
|
sd_bus_slot *prepare_for_sleep_slot;
|
|
struct udev *udev;
|
|
struct udev_monitor *udev_monitor;
|
|
sd_event_source *udev_event_source;
|
|
|
|
bool enumerating;
|
|
|
|
char *state_file;
|
|
LinkOperationalState operational_state;
|
|
|
|
Hashmap *links;
|
|
Hashmap *netdevs;
|
|
Hashmap *networks_by_name;
|
|
LIST_HEAD(Network, networks);
|
|
LIST_HEAD(AddressPool, address_pools);
|
|
|
|
usec_t network_dirs_ts_usec;
|
|
};
|
|
|
|
extern const char* const network_dirs[];
|
|
|
|
/* Manager */
|
|
|
|
extern const sd_bus_vtable manager_vtable[];
|
|
|
|
int manager_new(Manager **ret);
|
|
void manager_free(Manager *m);
|
|
|
|
int manager_connect_bus(Manager *m);
|
|
int manager_run(Manager *m);
|
|
|
|
int manager_load_config(Manager *m);
|
|
bool manager_should_reload(Manager *m);
|
|
|
|
int manager_rtnl_enumerate_links(Manager *m);
|
|
int manager_rtnl_enumerate_addresses(Manager *m);
|
|
|
|
int manager_send_changed(Manager *m, const char *property, ...) _sentinel_;
|
|
int manager_save(Manager *m);
|
|
|
|
int manager_address_pool_acquire(Manager *m, int family, unsigned prefixlen, union in_addr_union *found);
|
|
|
|
Link* manager_find_uplink(Manager *m, Link *exclude);
|
|
|
|
DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free);
|
|
#define _cleanup_manager_free_ _cleanup_(manager_freep)
|