Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6e27c9b4 authored by Jozsef Kadlecsik's avatar Jozsef Kadlecsik
Browse files

netfilter: ipset: Fix sparse warnings "incorrect type in assignment"

parent 2cbc78a2
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -114,7 +114,7 @@ nla_put_failure:
static inline void
static inline void
hash_ip4_data_next(struct ip_set_hash *h, const struct hash_ip4_elem *d)
hash_ip4_data_next(struct ip_set_hash *h, const struct hash_ip4_elem *d)
{
{
	h->next.ip = ntohl(d->ip);
	h->next.ip = d->ip;
}
}


static int
static int
@@ -188,7 +188,7 @@ hash_ip4_uadt(struct ip_set *set, struct nlattr *tb[],
	hosts = h->netmask == 32 ? 1 : 2 << (32 - h->netmask - 1);
	hosts = h->netmask == 32 ? 1 : 2 << (32 - h->netmask - 1);


	if (retried)
	if (retried)
		ip = h->next.ip;
		ip = ntohl(h->next.ip);
	for (; !before(ip_to, ip); ip += hosts) {
	for (; !before(ip_to, ip); ip += hosts) {
		nip = htonl(ip);
		nip = htonl(ip);
		if (nip == 0)
		if (nip == 0)
+7 −6
Original line number Original line Diff line number Diff line
@@ -130,8 +130,8 @@ static inline void
hash_ipport4_data_next(struct ip_set_hash *h,
hash_ipport4_data_next(struct ip_set_hash *h,
		       const struct hash_ipport4_elem *d)
		       const struct hash_ipport4_elem *d)
{
{
	h->next.ip = ntohl(d->ip);
	h->next.ip = d->ip;
	h->next.port = ntohs(d->port);
	h->next.port = d->port;
}
}


static int
static int
@@ -231,9 +231,10 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[],
	}
	}


	if (retried)
	if (retried)
		ip = h->next.ip;
		ip = ntohl(h->next.ip);
	for (; !before(ip_to, ip); ip++) {
	for (; !before(ip_to, ip); ip++) {
		p = retried && ip == h->next.ip ? h->next.port : port;
		p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port)
						       : port;
		for (; p <= port_to; p++) {
		for (; p <= port_to; p++) {
			data.ip = htonl(ip);
			data.ip = htonl(ip);
			data.port = htons(p);
			data.port = htons(p);
@@ -349,7 +350,7 @@ static inline void
hash_ipport6_data_next(struct ip_set_hash *h,
hash_ipport6_data_next(struct ip_set_hash *h,
		       const struct hash_ipport6_elem *d)
		       const struct hash_ipport6_elem *d)
{
{
	h->next.port = ntohs(d->port);
	h->next.port = d->port;
}
}


static int
static int
@@ -431,7 +432,7 @@ hash_ipport6_uadt(struct ip_set *set, struct nlattr *tb[],
		swap(port, port_to);
		swap(port, port_to);


	if (retried)
	if (retried)
		port = h->next.port;
		port = ntohs(h->next.port);
	for (; port <= port_to; port++) {
	for (; port <= port_to; port++) {
		data.port = htons(port);
		data.port = htons(port);
		ret = adtfn(set, &data, timeout, flags);
		ret = adtfn(set, &data, timeout, flags);
+7 −6
Original line number Original line Diff line number Diff line
@@ -133,8 +133,8 @@ static inline void
hash_ipportip4_data_next(struct ip_set_hash *h,
hash_ipportip4_data_next(struct ip_set_hash *h,
			 const struct hash_ipportip4_elem *d)
			 const struct hash_ipportip4_elem *d)
{
{
	h->next.ip = ntohl(d->ip);
	h->next.ip = d->ip;
	h->next.port = ntohs(d->port);
	h->next.port = d->port;
}
}


static int
static int
@@ -239,9 +239,10 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[],
	}
	}


	if (retried)
	if (retried)
		ip = h->next.ip;
		ip = ntohl(h->next.ip);
	for (; !before(ip_to, ip); ip++) {
	for (; !before(ip_to, ip); ip++) {
		p = retried && ip == h->next.ip ? h->next.port : port;
		p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port)
						       : port;
		for (; p <= port_to; p++) {
		for (; p <= port_to; p++) {
			data.ip = htonl(ip);
			data.ip = htonl(ip);
			data.port = htons(p);
			data.port = htons(p);
@@ -362,7 +363,7 @@ static inline void
hash_ipportip6_data_next(struct ip_set_hash *h,
hash_ipportip6_data_next(struct ip_set_hash *h,
			 const struct hash_ipportip6_elem *d)
			 const struct hash_ipportip6_elem *d)
{
{
	h->next.port = ntohs(d->port);
	h->next.port = d->port;
}
}


static int
static int
@@ -449,7 +450,7 @@ hash_ipportip6_uadt(struct ip_set *set, struct nlattr *tb[],
		swap(port, port_to);
		swap(port, port_to);


	if (retried)
	if (retried)
		port = h->next.port;
		port = ntohs(h->next.port);
	for (; port <= port_to; port++) {
	for (; port <= port_to; port++) {
		data.port = htons(port);
		data.port = htons(port);
		ret = adtfn(set, &data, timeout, flags);
		ret = adtfn(set, &data, timeout, flags);
+12 −9
Original line number Original line Diff line number Diff line
@@ -173,9 +173,9 @@ static inline void
hash_ipportnet4_data_next(struct ip_set_hash *h,
hash_ipportnet4_data_next(struct ip_set_hash *h,
			  const struct hash_ipportnet4_elem *d)
			  const struct hash_ipportnet4_elem *d)
{
{
	h->next.ip = ntohl(d->ip);
	h->next.ip = d->ip;
	h->next.port = ntohs(d->port);
	h->next.port = d->port;
	h->next.ip2 = ntohl(d->ip2);
	h->next.ip2 = d->ip2;
}
}


static int
static int
@@ -314,14 +314,17 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[],
	}
	}


	if (retried)
	if (retried)
		ip = h->next.ip;
		ip = ntohl(h->next.ip);
	for (; !before(ip_to, ip); ip++) {
	for (; !before(ip_to, ip); ip++) {
		data.ip = htonl(ip);
		data.ip = htonl(ip);
		p = retried && ip == h->next.ip ? h->next.port : port;
		p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port)
						       : port;
		for (; p <= port_to; p++) {
		for (; p <= port_to; p++) {
			data.port = htons(p);
			data.port = htons(p);
			ip2 = retried && ip == h->next.ip && p == h->next.port
			ip2 = retried
				? h->next.ip2 : ip2_from;
			      && ip == ntohl(h->next.ip)
			      && p == ntohs(h->next.port)
				? ntohl(h->next.ip2) : ip2_from;
			while (!after(ip2, ip2_to)) {
			while (!after(ip2, ip2_to)) {
				data.ip2 = htonl(ip2);
				data.ip2 = htonl(ip2);
				ip2_last = ip_set_range_to_cidr(ip2, ip2_to,
				ip2_last = ip_set_range_to_cidr(ip2, ip2_to,
@@ -486,7 +489,7 @@ static inline void
hash_ipportnet6_data_next(struct ip_set_hash *h,
hash_ipportnet6_data_next(struct ip_set_hash *h,
			  const struct hash_ipportnet6_elem *d)
			  const struct hash_ipportnet6_elem *d)
{
{
	h->next.port = ntohs(d->port);
	h->next.port = d->port;
}
}


static int
static int
@@ -598,7 +601,7 @@ hash_ipportnet6_uadt(struct ip_set *set, struct nlattr *tb[],
		swap(port, port_to);
		swap(port, port_to);


	if (retried)
	if (retried)
		port = h->next.port;
		port = ntohs(h->next.port);
	for (; port <= port_to; port++) {
	for (; port <= port_to; port++) {
		data.port = htons(port);
		data.port = htons(port);
		ret = adtfn(set, &data, timeout, flags);
		ret = adtfn(set, &data, timeout, flags);
+2 −2
Original line number Original line Diff line number Diff line
@@ -152,7 +152,7 @@ static inline void
hash_net4_data_next(struct ip_set_hash *h,
hash_net4_data_next(struct ip_set_hash *h,
		    const struct hash_net4_elem *d)
		    const struct hash_net4_elem *d)
{
{
	h->next.ip = ntohl(d->ip);
	h->next.ip = d->ip;
}
}


static int
static int
@@ -235,7 +235,7 @@ hash_net4_uadt(struct ip_set *set, struct nlattr *tb[],
			return -IPSET_ERR_HASH_RANGE;
			return -IPSET_ERR_HASH_RANGE;
	}
	}
	if (retried)
	if (retried)
		ip = h->next.ip;
		ip = ntohl(h->next.ip);
	while (!after(ip, ip_to)) {
	while (!after(ip, ip_to)) {
		data.ip = htonl(ip);
		data.ip = htonl(ip);
		last = ip_set_range_to_cidr(ip, ip_to, &data.cidr);
		last = ip_set_range_to_cidr(ip, ip_to, &data.cidr);
Loading