| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
#pragma once |
| 3 |
|
| 4 |
/*** |
| 5 |
Copyright © 2014 Intel Corporation. All rights reserved. |
| 6 |
***/ |
| 7 |
|
| 8 |
#include <net/ethernet.h> |
| 9 |
#include <netinet/in.h> |
| 10 |
|
| 11 |
#include "sd-event.h" |
| 12 |
#include "sd-ndisc.h" /* IWYU pragma: export */ |
| 13 |
|
| 14 |
#include "sd-forward.h" |
| 15 |
#include "network-common.h" |
| 16 |
#include "time-util.h" |
| 17 |
|
| 18 |
#define NDISC_ROUTER_SOLICITATION_INTERVAL (4U * USEC_PER_SEC) |
| 19 |
#define NDISC_MAX_ROUTER_SOLICITATION_INTERVAL (3600U * USEC_PER_SEC) |
| 20 |
#define NDISC_MAX_ROUTER_SOLICITATIONS 3U |
| 21 |
|
| 22 |
typedef struct sd_ndisc { |
| 23 |
unsigned n_ref; |
| 24 |
|
| 25 |
int ifindex; |
| 26 |
char *ifname; |
| 27 |
int fd; |
| 28 |
|
| 29 |
sd_event *event; |
| 30 |
int event_priority; |
| 31 |
|
| 32 |
struct in6_addr link_local_addr; |
| 33 |
struct ether_addr mac_addr; |
| 34 |
|
| 35 |
sd_event_source *recv_event_source; |
| 36 |
sd_event_source *timeout_event_source; |
| 37 |
sd_event_source *timeout_no_ra; |
| 38 |
|
| 39 |
usec_t retransmit_time; |
| 40 |
|
| 41 |
sd_ndisc_callback_t callback; |
| 42 |
void *userdata; |
| 43 |
} sd_ndisc; |
| 44 |
|
| 45 |
DECLARE_STRING_TABLE_LOOKUP(ndisc_event, sd_ndisc_event_t); |
| 46 |
|
| 47 |
#define log_ndisc_errno(ndisc, error, fmt, ...) \ |
| 48 |
log_interface_prefix_full_errno( \ |
| 49 |
"NDISC: ", \ |
| 50 |
sd_ndisc, ndisc, \ |
| 51 |
error, fmt, ##__VA_ARGS__) |
| 52 |
#define log_ndisc(ndisc, fmt, ...) \ |
| 53 |
log_interface_prefix_full_errno_zerook( \ |
| 54 |
"NDISC: ", \ |
| 55 |
sd_ndisc, ndisc, \ |
| 56 |
0, fmt, ##__VA_ARGS__) |