tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: arpresolve: inverted logic



On Jan 31,  6:22pm, max%m00nbsd.net@localhost (Maxime Villard) wrote:
-- Subject: Re: arpresolve: inverted logic

| Now; do we also agree on the fact that there is a m_put_rcvif(_rcvif, &s)
| missing before this goto [1]? Without talking about m_get_rcvif that could
| return NULL.
| 
| It seems to me we could also optimize a bit by not unnecessarily holding
| the lock if ifp->if_type != IFT_CARP.
| 
| [1] https://nxr.netbsd.org/xref/src/sys/netinet/if_arp.c#1317


Something like:

	if (ifp->if_type == IFT_CARP) {
		struct ifnet *rcvif = m_get_rcvif(m, &s);
		if (rcvif) {
			bool iscarp = rcvif->if_type == IFT_CARP;

			m_put_rcvif(rcvif, &s);
			if (!iscarp)
				goto out;
		}
	}

christos


Home | Main Index | Thread Index | Old Index