Project

General

Profile

« Previous | Next » 

Revision 89d1f0f2

Added by Scott Ullrich over 19 years ago

Sync get_interface_list() with HEAD

View differences:

etc/inc/util.inc
258 258
		break;
259 259
	}
260 260
        /* build interface list with netstat */
261
        exec("/usr/bin/netstat -inW -f link | awk '{ print $1, $4 } '", $linkinfo);
261
        exec("/usr/bin/netstat -inW -f link | awk '{ print $1, $4 }'", $linkinfo);
262 262
        array_shift($linkinfo);
263
        foreach ($linkinfo as $link) {
263
	/* build ip address list with netstat */
264
	exec("/usr/bin/netstat -inW -f inet | awk '{ print $1, $4 }'", $ipinfo);
265
	array_shift($ipinfo);
266
	foreach($linkinfo as $link) {
267
		$friendly = "";
264 268
                $alink = explode(" ", $link);
265 269
                $ifname = rtrim(trim($alink[0]), '*');
266 270
                if (!in_array(substr($ifname, 0, -1), $vfaces)) {
......
268 272
					"mac" => trim($alink[1]),
269 273
					"up" => in_array($ifname, $upints)
270 274
				);
275
			foreach($ipinfo as $ip) {
276
				$aip = explode(" ", $ip);
277
				if($aip[0] == $ifname) {
278
					$toput['ipaddr'] = $aip[1];
279
				}
280
			}
271 281
			foreach($config['interfaces'] as $name => $int) {
272 282
				if($int['if'] == $ifname) $friendly = $name;
273 283
			}
274 284
			switch($keyby) {
275 285
			case "physical":
276
				$toput['friendly'] = $friendly;
286
				if($friendly != "") {
287
					$toput['friendly'] = $friendly;
288
				}
277 289
				$iflist[$ifname] = $toput;
278 290
				break;
279 291
			case "friendly":
280
				$toput['if'] = $ifname;
281
				$iflist[$friendly] = $toput;
292
				if($friendly != "") {
293
					$toput['if'] = $ifname;
294
					$iflist[$friendly] = $toput;
295
				}
282 296
				break;
283 297
			}
284 298
                }

Also available in: Unified diff