shithub: riscv

ref: fe53c0930e8595a2e8b5aa71e907a1f2bec6059b
dir: /sys/src/libip/ipremoteonifc.c/

View raw version
#include <u.h>
#include <libc.h>
#include <ctype.h>
#include <ip.h>

Iplifc*
ipremoteonifc(Ipifc *ifc, uchar *ip)
{
	uchar net[IPaddrlen];
	Iplifc *lifc;

	for(lifc = ifc->lifc; lifc != nil; lifc = lifc->next){
		maskip(ip, lifc->mask, net);
		if(ipcmp(net, lifc->net) == 0)
			return lifc;
	}
	return nil;
}