@@ -330,33 +330,56 @@ static void handle_client_request(void *addr, void *data, size_t len,
330330 if (len < sizeof (* hdr ))
331331 return ;
332332
333- switch (hdr -> msg_type ) {
334- /* Valid message types for clients */
335- case DHCPV6_MSG_SOLICIT :
336- case DHCPV6_MSG_REQUEST :
337- case DHCPV6_MSG_CONFIRM :
338- case DHCPV6_MSG_RENEW :
339- case DHCPV6_MSG_REBIND :
340- case DHCPV6_MSG_RELEASE :
341- case DHCPV6_MSG_DECLINE :
342- case DHCPV6_MSG_INFORMATION_REQUEST :
343- case DHCPV6_MSG_RELAY_FORW :
333+ switch (iface -> dhcpv6 )
334+ {
335+ case MODE_DISABLED :
336+ if (!(iface -> ra == MODE_SERVER && iface -> ra_flags & ND_RA_FLAG_OTHER ))
337+ return ;
338+
339+ switch (hdr -> msg_type ) {
340+ case DHCPV6_MSG_INFORMATION_REQUEST :
341+ break ;
342+ default :
343+ return ;
344+ }
345+
346+ break ;
347+
348+ case MODE_SERVER :
349+ switch (hdr -> msg_type ) {
350+ /* Valid message types for clients */
351+ case DHCPV6_MSG_SOLICIT :
352+ case DHCPV6_MSG_REQUEST :
353+ case DHCPV6_MSG_CONFIRM :
354+ case DHCPV6_MSG_RENEW :
355+ case DHCPV6_MSG_REBIND :
356+ case DHCPV6_MSG_RELEASE :
357+ case DHCPV6_MSG_DECLINE :
358+ case DHCPV6_MSG_INFORMATION_REQUEST :
359+ case DHCPV6_MSG_RELAY_FORW :
344360#ifdef DHCPV4_SUPPORT
345- /* if we include DHCPV4 support, handle this message type */
346- case DHCPV6_MSG_DHCPV4_QUERY :
361+ /* if we include DHCPV4 support, handle this message type */
362+ case DHCPV6_MSG_DHCPV4_QUERY :
347363#endif
348- break ;
349- /* Invalid message types for clients i.e. server messages */
350- case DHCPV6_MSG_ADVERTISE :
351- case DHCPV6_MSG_REPLY :
352- case DHCPV6_MSG_RECONFIGURE :
353- case DHCPV6_MSG_RELAY_REPL :
364+ break ;
365+
366+ /* Invalid message types for clients i.e. server messages */
367+ case DHCPV6_MSG_ADVERTISE :
368+ case DHCPV6_MSG_REPLY :
369+ case DHCPV6_MSG_RECONFIGURE :
370+ case DHCPV6_MSG_RELAY_REPL :
354371#ifndef DHCPV4_SUPPORT
355- /* if we omit DHCPV4 support, ignore this client message type */
356- case DHCPV6_MSG_DHCPV4_QUERY :
372+ /* if we omit DHCPV4 support, ignore this client message type */
373+ case DHCPV6_MSG_DHCPV4_QUERY :
357374#endif
358- case DHCPV6_MSG_DHCPV4_RESPONSE :
359- default :
375+ case DHCPV6_MSG_DHCPV4_RESPONSE :
376+ return ;
377+ }
378+
379+ break ;
380+
381+ case MODE_HYBRID :
382+ case MODE_RELAY :
360383 return ;
361384 }
362385
@@ -803,13 +826,19 @@ static void handle_client_request(void *addr, void *data, size_t len,
803826static void handle_dhcpv6 (void * addr , void * data , size_t len ,
804827 struct interface * iface , void * dest_addr )
805828{
806- if (iface -> dhcpv6 == MODE_SERVER ) {
829+ switch (iface -> dhcpv6 ) {
830+ case MODE_SERVER :
831+ case MODE_DISABLED :
807832 handle_client_request (addr , data , len , iface , dest_addr );
808- } else if (iface -> dhcpv6 == MODE_RELAY ) {
833+ break ;
834+ case MODE_RELAY :
809835 if (iface -> master )
810836 relay_server_response (data , len );
811837 else
812838 relay_client_request (addr , data , len , iface );
839+ break ;
840+ case MODE_HYBRID :
841+ break ;
813842 }
814843}
815844
0 commit comments