[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: ifdown issue.
From: Rob Kramer <rob () solution-space ! com>
Date: 2018-11-23 7:26:14
Message-ID: 21837e52-4d5d-7466-09b7-c20c0d17e34c () solution-space ! com
[Download RAW message or body]
On a new Yocto build (with busybox 1.29) I noticed that 'ifdown eth0'
didn't work anymore, i.e. would just report:
ifdown: interface eth0 not configured
My ifstate file typically has two entries:
lo=lo
eth0=eth0
The issue is that ifupdown.c only seems to read a single line in the
ifstate file. I'm not familiar with the code, but it seems
xmalloc_fgets() doesn't break at newlines, and as such the loop in
read_iface_state() won't work.
If I change the code to use xmalloc_fgets_str(), it works as expectected
(see attached patch).
I'm not sure if this is the correct way to fix my issue, especially
since nobody has reported this yet :)
Cheers!
Rob
["0001-ifupdown-Fix-ifdown.patch" (text/x-patch)]
From 42ebec2b05a6a8d7d5b21eedf5635ebdd6565a05 Mon Sep 17 00:00:00 2001
From: Rob Kramer <rob@solution-space.com>
Date: Fri, 23 Nov 2018 15:19:21 +0800
Subject: [PATCH] ifupdown: Fix ifdown.
---
networking/ifupdown.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 5481134e5..a2f26cd4d 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -1306,7 +1306,7 @@ static llist_t *read_iface_state(void)
if (state_fp) {
char *start, *end_ptr;
- while ((start = xmalloc_fgets(state_fp)) != NULL) {
+ while ((start = xmalloc_fgets_str(state_fp, "\n")) != NULL) {
/* We should only need to check for a single character */
end_ptr = start + strcspn(start, " \t\n");
*end_ptr = '\0';
--
2.16.4
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic