ref: 0bc0f1cfcec73baddc58cab9a61c720bb8c15077
parent: a7eb8b11e4070683ded68913802c259f193afb9f
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Jun 10 18:23:03 EDT 2023
libip: actually add the files, sorry :(
--- /dev/null
+++ b/sys/src/libip/iplocalonifc.c
@@ -1,0 +1,16 @@
+#include <u.h>
+#include <libc.h>
+#include <ctype.h>
+#include <ip.h>
+
+Iplifc*
+iplocalonifc(Ipifc *ifc, uchar *ip)
+{
+ Iplifc *lifc;
+
+ for(lifc = ifc->lifc; lifc != nil; lifc = lifc->next){
+ if(ipcmp(ip, lifc->ip) == 0)
+ return lifc;
+ }
+ return nil;
+}
--- /dev/null
+++ b/sys/src/libip/ipremoteonifc.c
@@ -1,0 +1,18 @@
+#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;
+}