1 /* SPDX-License-Identifier: BSD-2-Clause */
3 * dhcpcd - DHCP client daemon
4 * Copyright (c) 2006-2019 Roy Marples <roy@marples.name>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 #define LINKLOCAL_ADDR 0xa9fe0000
33 #define LINKLOCAL_MASK IN_CLASSB_NET
34 #define LINKLOCAL_BCAST (LINKLOCAL_ADDR | ~LINKLOCAL_MASK)
37 # define IN_LINKLOCAL(addr) ((addr & IN_CLASSB_NET) == LINKLOCAL_ADDR)
44 struct in_addr pickedaddr
;
45 struct ipv4_addr
*addr
;
46 struct arp_state
*arp
;
47 char randomstate
[128];
53 #define IPV4LL_STATE(ifp) \
54 ((struct ipv4ll_state *)(ifp)->if_data[IF_DATA_IPV4LL])
55 #define IPV4LL_CSTATE(ifp) \
56 ((const struct ipv4ll_state *)(ifp)->if_data[IF_DATA_IPV4LL])
57 #define IPV4LL_STATE_RUNNING(ifp) \
58 (IPV4LL_CSTATE((ifp)) && !IPV4LL_CSTATE((ifp))->down && \
59 (IPV4LL_CSTATE((ifp))->addr != NULL))
61 int ipv4ll_subnetroute(rb_tree_t
*, struct interface
*);
62 int ipv4ll_defaultroute(rb_tree_t
*,struct interface
*);
63 ssize_t
ipv4ll_env(FILE *, const char *, const struct interface
*);
64 void ipv4ll_start(void *);
65 void ipv4ll_claimed(void *);
66 void ipv4ll_handle_failure(void *);
67 void ipv4ll_handleifa(int, struct ipv4_addr
*, pid_t pid
);
68 #ifdef HAVE_ROUTE_METRIC
69 int ipv4ll_recvrt(int, const struct rt
*);
72 void ipv4ll_reset(struct interface
*);
73 void ipv4ll_drop(struct interface
*);
74 void ipv4ll_free(struct interface
*);