1 /** 2 * Copyright (C) 2012-2014 Steven Barth <steven@midlink.org> 3 * Copyright (C) 2018 Hans Dedecker <dedeckeh@gmail.com> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License v2 as published by 7 * the Free Software Foundation. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 */ 15 16 #ifndef _RA_H_ 17 #define _RA_H_ 18 19 #include <netinet/in.h> 20 #include <stdbool.h> 21 #include <stdint.h> 22 23 #define ALL_IPV6_NODES {{{0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ 24 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}}} 25 26 #define ALL_IPV6_ROUTERS {{{0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ 27 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}}} 28 29 struct icmpv6_opt { 30 uint8_t type; 31 uint8_t len; 32 uint8_t data[6]; 33 }; 34 35 /* RFC8910 Captive-Portal ยง2.3 */ 36 struct icmpv6_opt_captive_portal { 37 uint8_t type; /* 37 */ 38 uint8_t len; /* includes the Type and Length fields, in units of 8 bytes */ 39 uint8_t data[]; /* padded with NUL (0x00) to make length multiple of 8 */ 40 }; 41 42 struct icmpv6_opt_route_info { 43 uint8_t type; 44 uint8_t len; 45 uint8_t prefix_len; 46 uint8_t flags; 47 uint32_t lifetime; 48 uint8_t prefix[]; 49 }; 50 51 typedef enum ra_ifid_mode { 52 RA_IFID_EUI64, 53 RA_IFID_FIXED, 54 RA_IFID_RANDOM, 55 RA_IFID_LLA, 56 } ra_ifid_mode_t; 57 58 #define ND_OPT_ROUTE_INFORMATION 24 59 #define ND_OPT_CAPTIVE_PORTAL 37 60 61 62 #define icmpv6_for_each_option(opt, start, end)\ 63 for (opt = (struct icmpv6_opt*)(start);\ 64 (void*)(opt + 1) <= (void*)(end) && opt->len > 0 &&\ 65 (void*)(opt + opt->len) <= (void*)(end); opt += opt->len) 66 67 68 int ra_init(const char *ifname, const struct in6_addr *ifid, 69 ra_ifid_mode_t ifid_mode, unsigned int options, 70 unsigned int holdoff_interval); 71 bool ra_link_up(void); 72 bool ra_process(void); 73 74 #endif /* _RA_H_ */ 75
This page was automatically generated by LXR 0.3.1. • OpenWrt