Bug 13916 - BusyBox's IP applet: flush all addresses if given device is not exist
Summary: BusyBox's IP applet: flush all addresses if given device is not exist
Status: RESOLVED DUPLICATE of bug 13906
Alias: None
Product: Busybox
Classification: Unclassified
Component: Networking (show other bugs)
Version: 1.31.x
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-05 10:33 UTC by Devi Allipilli
Modified: 2021-07-05 10:39 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Devi Allipilli 2021-07-05 10:33:25 UTC
we have identified that BusyBox's IP applet flush IP addresses of all device if device given in command is not exist in system

e.g:
#busybox ip -4 address flush dev abcdefg

In this case if device 'abcdefg' not exists on system then it will flush addresses of all interfaces.

This behaviour is same across all version of BusyBox and since inception.


RCA:
We have analysed the issue and identified that whenever we are calling 'xll_name_to_index' function to perform interface name to interface index opertation we are not cheking the return values of it in the caller functions.


Proposing the below patch for the fix and requesting you to do the needful.
May be need to look into other areas for the same condition.


PATCH:
--- busybox-1.31.1/networking/libiproute/ipaddress.c    2021-04-30 19:06:47.872878596 +0530
+++ ipaddress.c 2021-04-30 19:00:14.688899593 +0530
@@ -486,7 +486,9 @@ int FAST_FUNC ipaddr_list_or_flush(char
     ll_init_map(&rth);

 

        if (filter_dev) {
-               G_filter.ifindex = xll_name_to_index(filter_dev);
+               if((G_filter.ifindex = xll_name_to_index(filter_dev)) <= 0) {
+                       return 1;
+               }
        }

 

        if (flush) {
Comment 1 Devi Allipilli 2021-07-05 10:39:33 UTC

*** This bug has been marked as a duplicate of bug 13906 ***