1/* 2 * dhcpcd - DHCP client daemon 3 * Copyright (c) 2006-2012 Roy Marples <roy@marples.name> 4 * All rights reserved 5 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#ifndef IPV6_H 29#define IPV6_H 30 31#include <sys/queue.h> 32 33#include <netinet/in.h> 34 35#include "ipv6rs.h" 36 37#define ALLROUTERS "ff02::2" 38#define HOPLIMIT 255 39 40#define ROUNDUP8(a) (1 + (((a) - 1) | 7)) 41 42struct ipv6_addr { 43 TAILQ_ENTRY(ipv6_addr) next; 44 struct in6_addr prefix; 45 int prefix_len; 46 uint32_t prefix_vltime; 47 uint32_t prefix_pltime; 48 struct in6_addr addr; 49 int new; 50 char saddr[INET6_ADDRSTRLEN]; 51}; 52 53struct rt6 { 54 TAILQ_ENTRY(rt6) next; 55 struct in6_addr dest; 56 struct in6_addr net; 57 struct in6_addr gate; 58 const struct interface *iface; 59 struct ra *ra; 60 int metric; 61 unsigned int mtu; 62}; 63TAILQ_HEAD(rt6head, rt6); 64 65extern int socket_afnet6; 66 67int ipv6_open(void); 68struct in6_addr *ipv6_linklocal(const char *); 69int ipv6_makeaddr(struct in6_addr *, const char *, const struct in6_addr *, int); 70int ipv6_mask(struct in6_addr *, int); 71int ipv6_prefixlen(const struct in6_addr *); 72int ipv6_remove_subnet(struct ra *, struct ipv6_addr *); 73void ipv6_build_routes(void); 74void ipv6_drop(struct interface *); 75 76#endif 77