MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rn_refines

Function rn_refines

freebsd/net/radix.c:179–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177}
178
179int
180rn_refines(void *m_arg, void *n_arg)
181{
182 caddr_t m = m_arg, n = n_arg;
183 caddr_t lim, lim2 = lim = n + LEN(n);
184 int longer = LEN(n++) - LEN(m++);
185 int masks_are_equal = 1;
186
187 if (longer > 0)
188 lim -= longer;
189 while (n < lim) {
190 if (*n & ~(*m))
191 return (0);
192 if (*n++ != *m++)
193 masks_are_equal = 0;
194 }
195 while (n < lim2)
196 if (*n++)
197 return (0);
198 if (masks_are_equal && (longer < 0))
199 for (lim2 = m - longer; m < lim2; )
200 if (*m++)
201 return (1);
202 return (!masks_are_equal);
203}
204
205/*
206 * Search for exact match in given @head.

Callers 2

ifa_ifwithnetFunction · 0.85
rn_addrouteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected