2 * This file is part of the UCB release of Plan 9. It is subject to the license
3 * terms in the LICENSE file found in the top-level directory of this
4 * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
5 * part of the UCB release of Plan 9, including this file, may be copied,
6 * modified, propagated, or distributed except according to the terms contained
17 static uint8_t loopbacknet[IPaddrlen] = {
23 static uint8_t loopbackmask[IPaddrlen] = {
24 0xff, 0xff, 0xff, 0xff,
25 0xff, 0xff, 0xff, 0xff,
26 0xff, 0xff, 0xff, 0xff,
30 // find first ip addr that isn't the friggin loopback address
31 // unless there are no others
33 myipaddr(uint8_t *ip, char *net)
37 static struct ipifc *ifc;
38 uint8_t mynet[IPaddrlen];
40 ifc = readipifc(net, ifc, -1);
41 for(nifc = ifc; nifc; nifc = nifc->next)
42 for(lifc = nifc->lifc; lifc; lifc = lifc->next){
43 maskip(lifc->ip, loopbackmask, mynet);
44 if(ipcmp(mynet, loopbacknet) == 0){
47 if(ipcmp(lifc->ip, IPnoaddr) != 0){