aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-04-02 07:04:44 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-04-02 07:04:44 +0200
commit37201213ca45f2163abed70a213bb24956b243a8 (patch)
treeb0fb9484e8c322b272e2b07fc31904611d03afdd
parentb38af7bd31d98dd6e849354ee94ebafe580e7cc1 (diff)
downloadbusybox-w32-37201213ca45f2163abed70a213bb24956b243a8.tar.gz
busybox-w32-37201213ca45f2163abed70a213bb24956b243a8.tar.bz2
busybox-w32-37201213ca45f2163abed70a213bb24956b243a8.zip
ifplugd: more robust interface name match check
function old new delta check_existence_through_netlink 278 308 +30 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/ifplugd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/networking/ifplugd.c b/networking/ifplugd.c
index f398cca22..41b04c4ed 100644
--- a/networking/ifplugd.c
+++ b/networking/ifplugd.c
@@ -485,8 +485,10 @@ static smallint detect_link(void)
485 485
486static NOINLINE int check_existence_through_netlink(void) 486static NOINLINE int check_existence_through_netlink(void)
487{ 487{
488 int iface_len;
488 char replybuf[1024]; 489 char replybuf[1024];
489 490
491 iface_len = strlen(G.iface);
490 while (1) { 492 while (1) {
491 struct nlmsghdr *mhdr; 493 struct nlmsghdr *mhdr;
492 ssize_t bytes; 494 ssize_t bytes;
@@ -526,8 +528,9 @@ static NOINLINE int check_existence_through_netlink(void)
526 int len = RTA_PAYLOAD(attr); 528 int len = RTA_PAYLOAD(attr);
527 if (len > IFNAMSIZ) 529 if (len > IFNAMSIZ)
528 len = IFNAMSIZ; 530 len = IFNAMSIZ;
529 531 if (iface_len <= len
530 if (strncmp(G.iface, RTA_DATA(attr), len) == 0) { 532 && strncmp(G.iface, RTA_DATA(attr), len) == 0
533 ) {
531 G.iface_exists = (mhdr->nlmsg_type == RTM_NEWLINK); 534 G.iface_exists = (mhdr->nlmsg_type == RTM_NEWLINK);
532 } 535 }
533 } 536 }