blob: 7e98d1d53e513f603a2d042c587709870bb18f11 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
$NetBSD: patch-ai,v 1.1.1.1 2002/09/11 20:47:15 wiz Exp $
--- src/network.c.orig Fri May 24 17:13:04 2002
+++ src/network.c
@@ -353,8 +353,7 @@ GString *get_default_host_ip(void)
/* the following script does this: */
/* 1) extract the interface used by the default route: netstat -rn | grep ^0.0.0.0 | awk '{print $8;} */
/* 2) obtain the IP of this interface: netstat xxx | fgrep inet | cut -d : -f 2 | awk '{print $1;}' */
- const char *cmd=
- "/sbin/ifconfig `netstat -rn | grep ^0.0.0.0 | awk '{print $8;}'` | fgrep inet | cut -d : -f 2 | awk '{print $1;}'";
+ const char *cmd= "/sbin/route -n get default | awk '/local/{print$NF}'";
f=popen(cmd,"r");
if(f==NULL)
|