@@ -1742,16 +1742,22 @@ static void
17421742dhcp6_startdiscover (void * arg )
17431743{
17441744 struct interface * ifp ;
1745+ struct if_options * ifo ;
17451746 struct dhcp6_state * state ;
17461747 int llevel ;
17471748 struct ipv6_addr * ia ;
17481749
17491750 ifp = arg ;
17501751 state = D6_STATE (ifp );
1752+ ifo = ifp -> options ;
17511753#ifndef SMALL
17521754 if (state -> reason == NULL || strcmp (state -> reason , "TIMEOUT6" ) != 0 )
17531755 dhcp6_delete_delegates (ifp );
17541756#endif
1757+ /* Ensure we never request INFO_REFRESH_TIME,
1758+ * this only belongs in Information-Request messages */
1759+ del_option_mask (ifo -> requestmask6 , D6_OPTION_INFO_REFRESH_TIME );
1760+
17551761 if (state -> new == NULL && !state -> failed )
17561762 llevel = LOG_INFO ;
17571763 else
@@ -1784,9 +1790,11 @@ dhcp6_startinform(void *arg)
17841790 struct interface * ifp ;
17851791 struct dhcp6_state * state ;
17861792 int llevel ;
1793+ struct if_options * ifo ;
17871794
17881795 ifp = arg ;
17891796 state = D6_STATE (ifp );
1797+ ifo = ifp -> options ;
17901798 llevel = state -> failed ? LOG_DEBUG : LOG_INFO ;
17911799 logmessage (llevel , "%s: requesting DHCPv6 information" , ifp -> name );
17921800 state -> state = DH6S_INFORM ;
@@ -1796,6 +1804,9 @@ dhcp6_startinform(void *arg)
17961804 state -> MRT = state -> inf_max_rt ;
17971805 state -> MRC = 0 ;
17981806
1807+ /* Ensure we always request INFO_REFRESH_TIME as per rfc8415 */
1808+ add_option_mask (ifo -> requestmask6 , D6_OPTION_INFO_REFRESH_TIME );
1809+
17991810 if (dhcp6_makemessage (ifp ) == -1 ) {
18001811 logerr ("%s: %s" , __func__ , ifp -> name );
18011812 return ;
@@ -2815,19 +2826,21 @@ static void
28152826dhcp6_startinit (struct interface * ifp )
28162827{
28172828 struct dhcp6_state * state ;
2829+ struct if_options * ifo ;
28182830 ssize_t r ;
28192831 uint8_t has_ta , has_non_ta ;
28202832 size_t i ;
28212833
28222834 state = D6_STATE (ifp );
2835+ ifo = ifp -> options ;
28232836 state -> state = DH6S_INIT ;
28242837 state -> expire = ND6_INFINITE_LIFETIME ;
28252838 state -> lowpl = ND6_INFINITE_LIFETIME ;
28262839
28272840 dhcp6_addrequestedaddrs (ifp );
28282841 has_ta = has_non_ta = 0 ;
2829- for (i = 0 ; i < ifp -> options -> ia_len ; i ++ ) {
2830- switch (ifp -> options -> ia [i ].ia_type ) {
2842+ for (i = 0 ; i < ifo -> ia_len ; i ++ ) {
2843+ switch (ifo -> ia [i ].ia_type ) {
28312844 case D6_OPTION_IA_TA :
28322845 has_ta = 1 ;
28332846 break ;
@@ -2838,14 +2851,14 @@ dhcp6_startinit(struct interface *ifp)
28382851
28392852 if (!(ifp -> ctx -> options & DHCPCD_TEST ) &&
28402853 !(has_ta && !has_non_ta ) &&
2841- ifp -> options -> reboot != 0 )
2854+ ifo -> reboot != 0 )
28422855 {
28432856 r = dhcp6_readlease (ifp , 1 );
28442857 if (r == -1 ) {
28452858 if (errno != ENOENT && errno != ESRCH )
28462859 logerr ("%s: %s" , __func__ , state -> leasefile );
28472860 } else if (r != 0 &&
2848- !(ifp -> options -> options & DHCPCD_ANONYMOUS ))
2861+ !(ifo -> options & DHCPCD_ANONYMOUS ))
28492862 {
28502863 /* RFC 3633 section 12.1 */
28512864#ifndef SMALL
@@ -4059,13 +4072,10 @@ dhcp6_start1(void *arg)
40594072 del_option_mask (ifo -> requestmask6 , D6_OPTION_RAPID_COMMIT );
40604073#endif
40614074
4062- if (state -> state == DH6S_INFORM ) {
4063- add_option_mask (ifo -> requestmask6 , D6_OPTION_INFO_REFRESH_TIME );
4075+ if (state -> state == DH6S_INFORM )
40644076 dhcp6_startinform (ifp );
4065- } else {
4066- del_option_mask (ifo -> requestmask6 , D6_OPTION_INFO_REFRESH_TIME );
4077+ else
40674078 dhcp6_startinit (ifp );
4068- }
40694079
40704080#ifndef SMALL
40714081 dhcp6_activateinterfaces (ifp );
0 commit comments