• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/odhcpd/src/router.h

  1 /**
  2  * Copyright (C) 2012-2013 Steven Barth <steven@midlink.org>
  3  *
  4  * This program is free software; you can redistribute it and/or modify
  5  * it under the terms of the GNU General Public License v2 as published by
  6  * the Free Software Foundation.
  7  *
  8  * This program is distributed in the hope that it will be useful,
  9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 11  * GNU General Public License for more details.
 12  *
 13  */
 14 
 15 #ifndef _ROUTER_H_
 16 #define _ROUTER_H_
 17 
 18 #include <stdint.h>
 19 #include <netinet/in.h>
 20 #include <netinet/icmp6.h>
 21 
 22 struct icmpv6_opt {
 23         uint8_t type;
 24         uint8_t len;
 25         uint8_t data[6];
 26 };
 27 
 28 
 29 #define icmpv6_for_each_option(opt, start, end)\
 30         for (opt = (struct icmpv6_opt*)(start);\
 31         (void*)(opt + 1) <= (void*)(end) && opt->len > 0 &&\
 32         (void*)(opt + opt->len) <= (void*)(end); opt += opt->len)
 33 
 34 
 35 #define MaxInitialRtrAdvInterval        16
 36 #define MaxInitialRtAdvs                3
 37 /* RFC8319 §4
 38  * This document updates §4.2 and 6.2.1 of [RFC4861] to change
 39  * the following router configuration variables.
 40  *
 41  * In §6.2.1, inside the paragraph that defines
 42  * MaxRtrAdvInterval, change 1800 to 65535 seconds.
 43  *
 44  * In §6.2.1, inside the paragraph that defines
 45  * AdvDefaultLifetime, change 9000 to 65535 seconds.
 46  */
 47 #define MaxRtrAdvInterval                               65535
 48 #define MinRtrAdvInterval                               3
 49 #define AdvDefaultLifetime                              65535
 50 /* RFC8319 §4
 51  * This document updates §4.2 and 6.2.1 of [RFC4861] to change
 52  * the following router configuration variables.
 53  *
 54  * In §4.2, inside the paragraph that defines Router Lifetime,
 55  * change 9000 to 65535 seconds.
 56  *
 57  * Note: this is 16 bit Router Lifetime field in RA packets
 58  */
 59 /* RFC9096 defines recommended option lifetimes configuration values
 60  * ND_PREFERRED_LIMIT 2700
 61  * ND_VALID_LIMIT 5400
 62  *
 63  * RFC9096 §3.4
 64  * CE routers SHOULD set the "Router Lifetime" of Router Advertisement
 65  * (RA) messages to ND_PREFERRED_LIMIT.
 66  *
 67  * Note: while the RFC recommends SHOULD of ND_PREFERRED_LIMIT, this
 68  * define is used to cap values to a sane ceiling, i.e. ND_VALID_LIMIT.
 69  */
 70 #define RouterLifetime                                  5400
 71 /* RFC4861 §6.2.1 : AdvReachableTime :
 72  * MUST be no greater than 3,600,000 msec
 73  */
 74 #define AdvReachableTime                                3600000
 75 /* RFC4861 §6.2.1 : AdvCurHopLimit
 76  * The value should be set to the current
 77  * diameter of the Internet. The value zero means
 78  * unspecified (by this router).
 79  *
 80  * Note: this value is an 8 bit int, so max 255.
 81  */
 82 #define AdvCurHopLimit                                  255
 83 /* RFC4861 §10 - constants
 84  * Node constants:
 85  *     RETRANS_TIMER 1,000 milliseconds
 86  */
 87 #define RETRANS_TIMER_MAX                               60000
 88 /* RFC2460 §5
 89  * IPv6 requires that every link in the internet have an MTU of 1280
 90  * octets or greater.
 91  */
 92 #define RA_MTU_MIN                                              1280
 93 #define RA_MTU_MAX                                              65535
 94 
 95 #define ND_RA_FLAG_PROXY                0x4
 96 #define ND_RA_PREF_HIGH                 (1 << 3)
 97 #define ND_RA_PREF_LOW                  (3 << 3)
 98 
 99 /* RFC9762 DHCPv6 PD Availability - Preferred Flag
100  * use this until it is defined in netinet/icmp6.h
101  */
102 #define ND_OPT_PI_FLAG_PD_PREFERRED             0x10
103 
104 #endif /* _ROUTER_H_ */
105 

This page was automatically generated by LXR 0.3.1.  •  OpenWrt