Store a unique ID, an interface index, rather than a pointer to the
authormpi <mpi@openbsd.org>
Tue, 16 Jun 2015 11:09:39 +0000 (11:09 +0000)
committermpi <mpi@openbsd.org>
Tue, 16 Jun 2015 11:09:39 +0000 (11:09 +0000)
commitfb492c3701798fad8024e2bd164905788c83671b
treec6607492c9afd90379dbfbaae78d4ee451192462
parent50933c7b621fc99209f85811ec1c37a70d870ffa
Store a unique ID, an interface index, rather than a pointer to the
receiving interface in the packet header of every mbuf.

The interface pointer should now be retrieved when necessary with
if_get().  If a NULL pointer is returned by if_get(), the interface
has probably been destroy/removed and the mbuf should be freed.

Such mechanism will simplify garbage collection of mbufs and limit
problems with dangling ifp pointers.

Tested by jmatthew@ and krw@, discussed with many.

ok mikeb@, bluhm@, dlg@
56 files changed:
sys/kern/uipc_mbuf.c
sys/kern/uipc_socket.c
sys/net/bpf.c
sys/net/bpf.h
sys/net/bridgestp.c
sys/net/if.c
sys/net/if_bridge.c
sys/net/if_ethersubr.c
sys/net/if_loop.c
sys/net/if_mpe.c
sys/net/if_pflow.c
sys/net/if_pfsync.c
sys/net/if_ppp.c
sys/net/if_pppoe.c
sys/net/if_spppsubr.c
sys/net/if_trunk.c
sys/net/if_tun.c
sys/net/if_vlan.c
sys/net/pf.c
sys/net/pipex.c
sys/net/ppp_tty.c
sys/net/rtsock.c
sys/netinet/if_ether.c
sys/netinet/igmp.c
sys/netinet/in_gif.c
sys/netinet/ip_carp.c
sys/netinet/ip_divert.c
sys/netinet/ip_ether.c
sys/netinet/ip_gre.c
sys/netinet/ip_icmp.c
sys/netinet/ip_input.c
sys/netinet/ip_ipip.c
sys/netinet/ip_output.c
sys/netinet/ipsec_input.c
sys/netinet/tcp_input.c
sys/netinet/tcp_output.c
sys/netinet/tcp_subr.c
sys/netinet/udp_usrreq.c
sys/netinet6/frag6.c
sys/netinet6/icmp6.c
sys/netinet6/in6_gif.c
sys/netinet6/ip6_divert.c
sys/netinet6/ip6_forward.c
sys/netinet6/ip6_input.c
sys/netinet6/ip6_mroute.c
sys/netinet6/ip6_output.c
sys/netinet6/mld6.c
sys/netinet6/nd6.c
sys/netinet6/nd6_nbr.c
sys/netinet6/nd6_rtr.c
sys/netinet6/raw_ip6.c
sys/netmpls/mpls_input.c
sys/nfs/krpc_subr.c
sys/nfs/nfs_subs.c
sys/nfs/nfs_syscalls.c
sys/sys/mbuf.h