summaryrefslogtreecommitdiffstats
path: root/sbin/devd
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2005-10-04 22:22:51 +0000
committerimp <imp@FreeBSD.org>2005-10-04 22:22:51 +0000
commit1edcefa858ba0a4d52c23ff6281112e869c9f24b (patch)
tree4d730e1fb95a07449b4b23065d793d73161c52a0 /sbin/devd
parentec5bd3df63a65d9143691f569232b38371ad61df (diff)
downloadFreeBSD-src-1edcefa858ba0a4d52c23ff6281112e869c9f24b.zip
FreeBSD-src-1edcefa858ba0a4d52c23ff6281112e869c9f24b.tar.gz
media-type predicate is used in contexts where device-name is undefined.
In those contexted, use subsystem instead. # This causes dhclient to run again when I plug in my ethernet cable to # my fxp card in my laptop.
Diffstat (limited to 'sbin/devd')
-rw-r--r--sbin/devd/devd.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/sbin/devd/devd.cc b/sbin/devd/devd.cc
index ad3ef43..c5d009f 100644
--- a/sbin/devd/devd.cc
+++ b/sbin/devd/devd.cc
@@ -221,11 +221,19 @@ media::~media()
bool
media::do_match(config &c)
{
- string value = c.get_variable("device-name");
+ string value;
struct ifmediareq ifmr;
bool retval;
int s;
+ // Since we can be called from both a device attach/detach
+ // context where device-name is defined and what we want,
+ // as well as from a link status context, where subsystem is
+ // the name of interest, first try device-name and fall back
+ // to subsystem if none exists.
+ value = c.get_variable("device-name");
+ if (value.length() == 0)
+ string value = c.get_variable("subsystem");
if (Dflag)
fprintf(stderr, "Testing media type of %s against 0x%x\n",
value.c_str(), _type);
OpenPOWER on IntegriCloud