From b4d6e528d29958497e84463bb2c022caab0fb35c Mon Sep 17 00:00:00 2001 From: yar Date: Sat, 27 Oct 2007 19:57:41 +0000 Subject: Add a comment explaining why disc(4) bears the IFF_LOOPBACK flag. It should be the final follow-up to an old yet unfinished discussion on whether IFF_LOOPBACK is necessary for disc(4) and why. --- sys/net/if_disc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sys') diff --git a/sys/net/if_disc.c b/sys/net/if_disc.c index 51f05d5..98a06c1 100644 --- a/sys/net/if_disc.c +++ b/sys/net/if_disc.c @@ -92,6 +92,16 @@ disc_clone_create(struct if_clone *ifc, int unit, caddr_t params) ifp->if_softc = sc; if_initname(ifp, ifc->ifc_name, unit); ifp->if_mtu = DSMTU; + /* + * IFF_LOOPBACK should not be removed from disc's flags because + * it controls what PF-specific routes are magically added when + * a network address is assigned to the interface. Things just + * won't work as intended w/o such routes because the output + * interface selection for a packet is totally route-driven. + * A valid alternative to IFF_LOOPBACK can be IFF_BROADCAST or + * IFF_POINTOPOINT, but it would result in different properties + * of the interface. + */ ifp->if_flags = IFF_LOOPBACK | IFF_MULTICAST; ifp->if_drv_flags = IFF_DRV_RUNNING; ifp->if_ioctl = discioctl; -- cgit v1.1