Skip to content

Commit

Permalink
lo: Use new KPI to create the first loop interface
Browse files Browse the repository at this point in the history
While here remove a pointless static local variable lo_cloner.

No functional change intended.

Reviewed by:	kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45728
  • Loading branch information
gmshake committed Jun 26, 2024
1 parent 8502c68 commit 2cb7605
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions sys/net/if_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,9 @@ static int looutput(struct ifnet *ifp, struct mbuf *m,
const struct sockaddr *dst, struct route *ro);

VNET_DEFINE(struct ifnet *, loif); /* Used externally */

#ifdef VIMAGE
VNET_DEFINE_STATIC(struct if_clone *, lo_cloner);
#define V_lo_cloner VNET(lo_cloner)
#endif

static struct if_clone *lo_cloner;
static const char loname[] = "lo";

static int
Expand Down Expand Up @@ -141,8 +137,6 @@ lo_clone_create(struct if_clone *ifc, char *name, size_t len,
ifp->if_hwassist = LO_CSUM_FEATURES | LO_CSUM_FEATURES6;
if_attach(ifp);
bpfattach(ifp, DLT_NULL, sizeof(u_int32_t));
if (V_loif == NULL)
V_loif = ifp;
*ifpp = ifp;

return (0);
Expand All @@ -156,12 +150,9 @@ vnet_loif_init(const void *unused __unused)
.destroy_f = lo_clone_destroy,
.flags = IFC_F_AUTOUNIT,
};
lo_cloner = ifc_attach_cloner(loname, &req);
#ifdef VIMAGE
V_lo_cloner = lo_cloner;
#endif
V_lo_cloner = ifc_attach_cloner(loname, &req);
struct ifc_data ifd = { .unit = 0 };
ifc_create_ifp(loname, &ifd, NULL);
ifc_create_ifp(loname, &ifd, &V_loif);
}
VNET_SYSINIT(vnet_loif_init, SI_SUB_PSEUDO, SI_ORDER_ANY,
vnet_loif_init, NULL);
Expand Down

0 comments on commit 2cb7605

Please sign in to comment.