@@ -885,31 +885,33 @@ int config_parse_encap_limit(
885885 void * data ,
886886 void * userdata ) {
887887
888- Tunnel * t = userdata ;
889- int k = 0 ;
890- int r ;
888+ Tunnel * t = ASSERT_PTR (userdata );
889+ int k , r ;
891890
892891 assert (filename );
893- assert (lvalue );
894892 assert (rvalue );
895893
896- if (streq (rvalue , "none" ))
894+ if (streq (rvalue , "none" )) {
897895 t -> flags |= IP6_TNL_F_IGN_ENCAP_LIMIT ;
898- else {
899- r = safe_atoi (rvalue , & k );
900- if (r < 0 ) {
901- log_syntax (unit , LOG_WARNING , filename , line , r , "Failed to parse Tunnel Encapsulation Limit option, ignoring: %s" , rvalue );
902- return 0 ;
903- }
896+ t -> encap_limit = 0 ;
897+ return 0 ;
898+ }
904899
905- if (k > 255 || k < 0 )
906- log_syntax (unit , LOG_WARNING , filename , line , 0 , "Invalid Tunnel Encapsulation value, ignoring: %d" , k );
907- else {
908- t -> encap_limit = k ;
909- t -> flags &= ~IP6_TNL_F_IGN_ENCAP_LIMIT ;
910- }
900+ r = safe_atoi (rvalue , & k );
901+ if (r < 0 ) {
902+ log_syntax (unit , LOG_WARNING , filename , line , r ,
903+ "Failed to parse Tunnel Encapsulation Limit option, ignoring assignment: %s" , rvalue );
904+ return 0 ;
905+ }
906+
907+ if (k > 255 || k < 0 ) {
908+ log_syntax (unit , LOG_WARNING , filename , line , 0 ,
909+ "Invalid Tunnel Encapsulation value, ignoring assignment: %d" , k );
910+ return 0 ;
911911 }
912912
913+ t -> encap_limit = k ;
914+ t -> flags &= ~IP6_TNL_F_IGN_ENCAP_LIMIT ;
913915 return 0 ;
914916}
915917
0 commit comments