1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 This file is part of systemd.
7 Copyright (C) 2017 Intel Corporation. All rights reserved.
9 systemd is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation; either version 2.1 of the License, or
12 (at your option) any later version.
14 systemd is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public License
20 along with systemd; If not, see <http://www.gnu.org/licenses/>.
27 #include "sparse-endian.h"
29 assert_cc(SD_RADV_DEFAULT_MIN_TIMEOUT_USEC
<= SD_RADV_DEFAULT_MAX_TIMEOUT_USEC
)
31 #define SD_RADV_MAX_INITIAL_RTR_ADVERT_INTERVAL_USEC (16*USEC_PER_SEC)
32 #define SD_RADV_MAX_INITIAL_RTR_ADVERTISEMENTS 3
33 #define SD_RADV_MAX_FINAL_RTR_ADVERTISEMENTS 3
34 #define SD_RADV_MIN_DELAY_BETWEEN_RAS 3
35 #define SD_RADV_MAX_RA_DELAY_TIME_USEC (500*USEC_PER_MSEC)
37 #define SD_RADV_OPT_RDNSS 25
38 #define SD_RADV_OPT_DNSSL 31
41 SD_RADV_STATE_IDLE
= 0,
42 SD_RADV_STATE_ADVERTISING
= 1,
44 typedef enum RAdvState RAdvState
;
46 struct sd_radv_opt_dns
{
62 struct ether_addr mac_addr
;
70 sd_event_source
*recv_event_source
;
71 sd_event_source
*timeout_event_source
;
74 LIST_HEAD(sd_radv_prefix
, prefixes
);
77 struct sd_radv_opt_dns
*rdnss
;
78 struct sd_radv_opt_dns
*dnssl
;
81 struct sd_radv_prefix
{
89 be32_t valid_lifetime
;
90 be32_t preferred_lifetime
;
92 struct in6_addr in6_addr
;
95 LIST_FIELDS(struct sd_radv_prefix
, prefix
);
98 #define log_radv_full(level, error, fmt, ...) log_internal(level, error, __FILE__, __LINE__, __func__, "RADV: " fmt, ##__VA_ARGS__)
99 #define log_radv_errno(error, fmt, ...) log_radv_full(LOG_DEBUG, error, fmt, ##__VA_ARGS__)
100 #define log_radv_warning_errno(error, fmt, ...) log_radv_full(LOG_WARNING, error, fmt, ##__VA_ARGS__)
101 #define log_radv(fmt, ...) log_radv_errno(0, fmt, ##__VA_ARGS__)