⬢ DragonFlyBSD Kernel Audit
DF-3462 / fix.diff
← back to finding ↓ download raw
--- a/sys/net/ipfw3/ip_fw3_set.c
+++ b/sys/net/ipfw3/ip_fw3_set.c
@@ -188,17 +188,30 @@
 	return 0;
 }
 
+void
+set_toggle_dispatch(netmsg_t smsg)
+{
+	struct netmsg_sets *msg = (struct netmsg_sets *)smsg;
+	struct ipfw3_context *ctx = fw3_ctx[mycpuid];
+
+	ctx->sets = ctx->sets ^ (1 << msg->set_to);
+	netisr_forwardmsg_all(&smsg->base, mycpuid + 1);
+}
+
 int
 ip_fw3_ctl_set_toggle(struct sockopt *sopt)
 {
-	struct ipfw3_context *ctx;
+	struct netmsg_sets msg;
 	int *num;
 
-	ctx = fw3_ctx[mycpuid];
-
 	num =(int *)sopt->sopt_val;
 	if (*num > 0 && *num < 32) {
-		ctx->sets = ctx->sets ^ (1 << *num);
+		bzero(&msg, sizeof(msg));
+		netmsg_init(&msg.base, NULL, &curthread->td_msgport,
+				0, set_toggle_dispatch);
+		msg.set_to = *num;
+
+		netisr_domsg(&msg.base, 0);
 	}
 	return 0;
 }
--- a/sys/net/ipfw3/ip_fw3_set.h
+++ b/sys/net/ipfw3/ip_fw3_set.h
@@ -49,6 +49,7 @@
 void	move_rule_dispatch(netmsg_t smsg);
 int	ip_fw3_ctl_set_move_rule(struct sockopt *sopt);
 void	set_swap_dispatch(netmsg_t msg);
+void	set_toggle_dispatch(netmsg_t smsg);
 int	ip_fw3_ctl_set_swap(struct sockopt *sopt);
 int	ip_fw3_ctl_set_toggle(struct sockopt *sopt);
 int	ip_fw3_ctl_set_get(struct sockopt *sopt);