@@ -173,9 +173,9 @@ static inline void
173173hash_ipportnet4_data_next (struct ip_set_hash * h ,
174174 const struct hash_ipportnet4_elem * d )
175175{
176- h -> next .ip = ntohl ( d -> ip ) ;
177- h -> next .port = ntohs ( d -> port ) ;
178- h -> next .ip2 = ntohl ( d -> ip2 ) ;
176+ h -> next .ip = d -> ip ;
177+ h -> next .port = d -> port ;
178+ h -> next .ip2 = d -> ip2 ;
179179}
180180
181181static int
@@ -314,14 +314,17 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[],
314314 }
315315
316316 if (retried )
317- ip = h -> next .ip ;
317+ ip = ntohl ( h -> next .ip ) ;
318318 for (; !before (ip_to , ip ); ip ++ ) {
319319 data .ip = htonl (ip );
320- p = retried && ip == h -> next .ip ? h -> next .port : port ;
320+ p = retried && ip == ntohl (h -> next .ip ) ? ntohs (h -> next .port )
321+ : port ;
321322 for (; p <= port_to ; p ++ ) {
322323 data .port = htons (p );
323- ip2 = retried && ip == h -> next .ip && p == h -> next .port
324- ? h -> next .ip2 : ip2_from ;
324+ ip2 = retried
325+ && ip == ntohl (h -> next .ip )
326+ && p == ntohs (h -> next .port )
327+ ? ntohl (h -> next .ip2 ) : ip2_from ;
325328 while (!after (ip2 , ip2_to )) {
326329 data .ip2 = htonl (ip2 );
327330 ip2_last = ip_set_range_to_cidr (ip2 , ip2_to ,
@@ -486,7 +489,7 @@ static inline void
486489hash_ipportnet6_data_next (struct ip_set_hash * h ,
487490 const struct hash_ipportnet6_elem * d )
488491{
489- h -> next .port = ntohs ( d -> port ) ;
492+ h -> next .port = d -> port ;
490493}
491494
492495static int
@@ -598,7 +601,7 @@ hash_ipportnet6_uadt(struct ip_set *set, struct nlattr *tb[],
598601 swap (port , port_to );
599602
600603 if (retried )
601- port = h -> next .port ;
604+ port = ntohs ( h -> next .port ) ;
602605 for (; port <= port_to ; port ++ ) {
603606 data .port = htons (port );
604607 ret = adtfn (set , & data , timeout , flags );
0 commit comments