git: 82c1ab4413e0 - stable/13 - ifnet: Remove dead code

From: Zhenlei Huang <zlei_at_FreeBSD.org>
Date: Mon, 08 Jul 2024 11:41:56 UTC
The branch stable/13 has been updated by zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=82c1ab4413e090f35870d471c97109299ad62fa8

commit 82c1ab4413e090f35870d471c97109299ad62fa8
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2024-06-30 09:44:21 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2024-07-08 11:36:30 +0000

    ifnet: Remove dead code
    
    Since change [1], if_bpf will not be detached by the interface departure
    eventhandler and will not be NULL. Then the logic to re-attach if_bpf
    becomes dead and serves no purpose any more.
    
    This partially reverts commit 05fc416403ec.
    
    1. 9ce40d321dd5 bpf: Fix incorrect cleanup
    
    Reviewed by:    kp
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D45599
    
    (cherry picked from commit 9738277b5c662a75347efa6a58daea485d30f895)
    (cherry picked from commit a8790965b0c6b63ec64c42f236cd09cef06f481c)
---
 sys/net/if.c | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/sys/net/if.c b/sys/net/if.c
index e457ce5c4705..a7aed084143c 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1314,21 +1314,9 @@ static int
 if_vmove(struct ifnet *ifp, struct vnet *new_vnet)
 {
 	struct if_clone *ifc;
-#ifdef DEV_BPF
-	u_int bif_dlt, bif_hdrlen;
-#endif
 	void *old;
 	int rc;
 
-#ifdef DEV_BPF
- 	/*
-	 * if_detach_internal() will call the eventhandler to notify
-	 * interface departure.  That will detach if_bpf.  We need to
-	 * safe the dlt and hdrlen so we can re-attach it later.
-	 */
-	bpf_get_bp_params(ifp->if_bpf, &bif_dlt, &bif_hdrlen);
-#endif
-
 	/*
 	 * Detach from current vnet, but preserve LLADDR info, do not
 	 * mark as dead etc. so that the ifnet can be reattached later.
@@ -1374,11 +1362,6 @@ if_vmove(struct ifnet *ifp, struct vnet *new_vnet)
 
 	if_attach_internal(ifp, 1, ifc);
 
-#ifdef DEV_BPF
-	if (ifp->if_bpf == NULL)
-		bpfattach(ifp, bif_dlt, bif_hdrlen);
-#endif
-
 	CURVNET_RESTORE();
 	return (0);
 }