From ad6daee73d2a7092f7fa274e58dc363da533858e Mon Sep 17 00:00:00 2001
From: Markus Gothe <markus.gothe@genexis.eu>
Date: Thu, 23 Jan 2025 15:50:52 +0100
Subject: [PATCH] Solve warnings.

---
 src/ebt_igmpsnooping.c | 23 ++++++++++++-----------
 src/ebt_mldsnooping.c  | 25 +++++++++++++------------
 2 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/src/ebt_igmpsnooping.c b/src/ebt_igmpsnooping.c
index eaf5622..f0a34a7 100644
--- a/src/ebt_igmpsnooping.c
+++ b/src/ebt_igmpsnooping.c
@@ -101,8 +101,8 @@ static void add_igmpv3_entry(const struct iphdr *ih, __be16 protocol, unsigned s
 			igmp->ivid = ivid;
 			igmp->saddr = ih->saddr;
 			igmp->group = group;
-			strcpy(igmp->br, br_port_get_rcu(xt_in(par))->br->dev->name); /* Save name instead of pointer to device, the latter might disappear from the system. */
-			strcpy(igmp->port, xt_inname(par));
+			strcpy(igmp->br, br_port_get_rcu(xt_in(par))->br->dev->name); /* Save name instead of pointer to device, the latter might disappear from the system. */ // flawfinder: ignore
+			strcpy(igmp->port, xt_inname(par)); // flawfinder: ignore
 			if (protocol == htons(ETH_P_PPP_SES))
 				igmp->isPPPoE = true;
 			igmp->version = 3;
@@ -221,8 +221,8 @@ static inline bool ebt_ip_mt(const struct iphdr *ih, struct sk_buff *skb, __be16
 			igmp->ivid = ivid;
 			igmp->saddr = ih->saddr;
 			igmp->group = pptr->group;
-			strcpy(igmp->br, br_port_get_rcu(xt_in(par))->br->dev->name); /* Save name instead of pointer to device, the latter might disappear from the system. */
-			strcpy(igmp->port, xt_inname(par));
+			strcpy(igmp->br, br_port_get_rcu(xt_in(par))->br->dev->name); /* Save name instead of pointer to device, the latter might disappear from the system. */ // flawfinder: ignore
+			strcpy(igmp->port, xt_inname(par)); // flawfinder: ignore
 			if (protocol == htons(ETH_P_PPP_SES))
 				igmp->isPPPoE = true;
 			if (pptr->type == IGMPV2_HOST_MEMBERSHIP_REPORT)
@@ -287,8 +287,8 @@ again:
 
 				protocol = vlan->h_vlan_encapsulated_proto;
 				ivid = (ntohs(vlan->h_vlan_TCI) & VLAN_VID_MASK);
-				skb_pull(skb, VLAN_HLEN);
-				skb_reset_network_header(skb);
+				skb_pull((struct sk_buff *)skb, VLAN_HLEN);
+				skb_reset_network_header((struct sk_buff *)skb);
 				vlan_hdr_count++;
 			}
 			goto again;
@@ -301,13 +301,13 @@ again:
 	}
 
 	/* Business logic goes here */
-	ret = ebt_ip_mt(iph, skb, protocol, ovid, ivid, par);
+	ret = ebt_ip_mt(iph, (struct sk_buff *)skb, protocol, ovid, ivid, par);
 
 out:
 	/* Restore the skb for the pulled VLAN tags */
 	while (vlan_hdr_count--) {
-		skb_push(skb, VLAN_HLEN);
-		skb_reset_network_header(skb);
+		skb_push((struct sk_buff *)skb, VLAN_HLEN);
+		skb_reset_network_header((struct sk_buff *)skb);
 	}
 
 	return ret;
@@ -341,8 +341,9 @@ static int igmp_device_event(struct notifier_block *unused, unsigned long event,
 	case NETDEV_CHANGE:
 		if (netif_carrier_ok(dev))
 			return NOTIFY_DONE;
-		 /* fall through */
-	case NETDEV_UNREGISTER: /* fall through */
+		fallthrough;
+	case NETDEV_UNREGISTER:
+		fallthrough;
 	case NETDEV_DOWN:
 		spin_lock_bh(&igmp_lock);
 		list_for_each_safe(cur, next, &igmp_info_list) {
diff --git a/src/ebt_mldsnooping.c b/src/ebt_mldsnooping.c
index ef99fa7..a2c48b6 100644
--- a/src/ebt_mldsnooping.c
+++ b/src/ebt_mldsnooping.c
@@ -103,8 +103,8 @@ static void add_mldv2_entry(const struct ipv6hdr *ih6, __be16 protocol, unsigned
 			mld->ivid = ivid;
 			mld->saddr = ih6->saddr;
 			mld->group = *group;
-			strcpy(mld->br, br_port_get_rcu(xt_in(par))->br->dev->name); /* Save name instead of pointer to device, the latter might disappear from the system. */
-			strcpy(mld->port, xt_inname(par));
+			strcpy(mld->br, br_port_get_rcu(xt_in(par))->br->dev->name); /* Save name instead of pointer to device, the latter might disappear from the system. */ // flawfinder: ignore
+			strcpy(mld->port, xt_inname(par)); // flawfinder: ignore
 			if (protocol == htons(ETH_P_PPP_SES))
 				mld->isPPPoE = true;
 			mld->version = 2;
@@ -233,8 +233,8 @@ static inline bool ebt_ip6_mt(const struct ipv6hdr *ih6, struct sk_buff *skb, __
 			mld->ivid = ivid;
 			mld->saddr = ih6->saddr;
 			mld->group = pptr->mld_mca;
-			strcpy(mld->br, br_port_get_rcu(xt_in(par))->br->dev->name); /* Save name instead of pointer to device, the latter might disappear from the system. */
-			strcpy(mld->port, xt_inname(par));
+			strcpy(mld->br, br_port_get_rcu(xt_in(par))->br->dev->name); /* Save name instead of pointer to device, the latter might disappear from the system. */ // flawfinder: ignore
+			strcpy(mld->port, xt_inname(par)); // flawfinder: ignore
 			if (protocol == htons(ETH_P_PPP_SES))
 				mld->isPPPoE = true;
 			mld->version = 1;
@@ -251,7 +251,7 @@ static inline bool ebt_ip6_mt(const struct ipv6hdr *ih6, struct sk_buff *skb, __
 	return true;
 }
 
-static bool ebt_mld_mt(struct sk_buff *skb, struct xt_action_param *par)
+static bool ebt_mld_mt(const struct sk_buff *skb, struct xt_action_param *par)
 {
 	const struct ipv6hdr *ipv6h = NULL;
 	struct ipv6hdr _ipv6h;
@@ -297,8 +297,8 @@ again:
 
 				protocol = vlan->h_vlan_encapsulated_proto;
 				ivid = (ntohs(vlan->h_vlan_TCI) & VLAN_VID_MASK);
-				skb_pull(skb, VLAN_HLEN);
-				skb_reset_network_header(skb);
+				skb_pull((struct sk_buff *)skb, VLAN_HLEN);
+				skb_reset_network_header((struct sk_buff *)skb);
 				vlan_hdr_count++;
 			}
 			goto again;
@@ -311,13 +311,13 @@ again:
 	}
 
 	/* Business logic goes here */
-	ret = ebt_ip6_mt(ipv6h, skb, protocol, ovid, ivid, par);
+	ret = ebt_ip6_mt(ipv6h, (struct sk_buff *)skb, protocol, ovid, ivid, par);
 
 out:
 	/* Restore the skb for the pulled VLAN tags */
 	while (vlan_hdr_count--) {
-		skb_push(skb, VLAN_HLEN);
-		skb_reset_network_header(skb);
+		skb_push((struct sk_buff *)skb, VLAN_HLEN);
+		skb_reset_network_header((struct sk_buff *)skb);
 	}
 
 	return ret;
@@ -351,8 +351,9 @@ static int mld_device_event(struct notifier_block *unused, unsigned long event,
 	case NETDEV_CHANGE:
 		if (netif_carrier_ok(dev))
 			return NOTIFY_DONE;
-		 /* fall through */
-	case NETDEV_UNREGISTER: /* fall through */
+		fallthrough;
+	case NETDEV_UNREGISTER:
+		fallthrough;
 	case NETDEV_DOWN:
 		spin_lock_bh(&mld_lock);
 		list_for_each_safe(cur, next, &mld_info_list) {
-- 
GitLab