Subject: kern/26402: pfil_run_hooks() called at the wrong place
To: None <gnats-bugs@gnats.NetBSD.org>
From: Peter Postma <peter@pointless.nl>
List: netbsd-bugs
Date: 07/22/2004 13:02:12
>Number: 26402
>Category: kern
>Synopsis: pfil_run_hooks() called at the wrong place
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jul 22 11:03:01 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator: Peter Postma
>Release: NetBSD 2.0G
>Organization:
>Environment:
System: NetBSD mercury.pointless.nl 2.0G NetBSD 2.0G (mercury) #22: Thu Jul 22 12:48:08 CEST 2004 peter@mercury.pointless.nl:/usr/obj/sys/arch/sparc64/compile/mercury sparc64
Architecture: sparc64
Machine: sparc64
>Description:
recently, there were some changes added to sys/netinet/in.c to detect
interface address changes with pfil(9).
but one change was added at the wrong place and for the wrong ioctl #.
it is the pfil_run_hooks() under SIOCGIFALIAS (get if alias).
this must off course be under SIOCAIFADDR (add if alias).
>How-To-Repeat:
inspect code.
>Fix:
add code to the right ioctl #. also fix ioctl in pf code.
Index: in.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/in.c,v
retrieving revision 1.98
diff -u -r1.98 in.c
--- in.c 18 Jul 2004 11:37:38 -0000 1.98
+++ in.c 21 Jul 2004 18:19:58 -0000
@@ -512,6 +512,11 @@
if ((ifp->if_flags & IFF_BROADCAST) &&
(ifra->ifra_broadaddr.sin_family == AF_INET))
ia->ia_broadaddr = ifra->ifra_broadaddr;
+#ifdef PFIL_HOOKS
+ if (!error)
+ (void)pfil_run_hooks(&if_pfil,
+ (struct mbuf **)SIOCAIFADDR, ifp, PFIL_IFADDR);
+#endif
return (error);
case SIOCGIFALIAS:
@@ -525,10 +530,6 @@
else
bzero(&ifra->ifra_broadaddr,
sizeof(ifra->ifra_broadaddr));
-#ifdef PFIL_HOOKS
- (void)pfil_run_hooks(&if_pfil,
- (struct mbuf **)SIOCGIFALIAS, ifp, PFIL_IFADDR);
-#endif
return 0;
case SIOCDIFADDR:
Index: pf_ioctl.c
===================================================================
RCS file: /cvsroot/src/sys/dist/pf/net/pf_ioctl.c,v
retrieving revision 1.6
diff -u -r1.6 pf_ioctl.c
--- pf_ioctl.c 29 Jun 2004 04:42:55 -0000 1.6
+++ pf_ioctl.c 22 Jul 2004 10:58:05 -0000
@@ -2809,7 +2809,7 @@
pfi_attach_ifnet(ifp);
break;
case SIOCSIFADDR:
- case SIOCGIFALIAS:
+ case SIOCAIFADDR:
case SIOCDIFADDR:
pfi_kifaddr_update((struct ifnet *)arg);
break;
>Release-Note:
>Audit-Trail:
>Unformatted: