aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--networking/libiproute/ll_map.c25
1 files changed, 1 insertions, 24 deletions
diff --git a/networking/libiproute/ll_map.c b/networking/libiproute/ll_map.c
index e2b85fc7b..af9eb46f7 100644
--- a/networking/libiproute/ll_map.c
+++ b/networking/libiproute/ll_map.c
@@ -136,7 +136,6 @@ unsigned FAST_FUNC ll_index_to_flags(int idx)
136int FAST_FUNC xll_name_to_index(const char *name) 136int FAST_FUNC xll_name_to_index(const char *name)
137{ 137{
138 int ret = 0; 138 int ret = 0;
139 int sock_fd;
140 139
141/* caching is not warranted - no users which repeatedly call it */ 140/* caching is not warranted - no users which repeatedly call it */
142#ifdef UNUSED 141#ifdef UNUSED
@@ -164,30 +163,8 @@ int FAST_FUNC xll_name_to_index(const char *name)
164 } 163 }
165 } 164 }
166 } 165 }
167 /* We have not found the interface in our cache, but the kernel
168 * may still know about it. One reason is that we may be using
169 * module on-demand loading, which means that the kernel will
170 * load the module and make the interface exist only when
171 * we explicitely request it (check for dev_load() in net/core/dev.c).
172 * I can think of other similar scenario, but they are less common...
173 * Jean II */
174#endif 166#endif
175 167 ret = if_nametoindex(name);
176 sock_fd = socket(AF_INET, SOCK_DGRAM, 0);
177 if (sock_fd >= 0) {
178 struct ifreq ifr;
179 int tmp;
180
181 strncpy_IFNAMSIZ(ifr.ifr_name, name);
182 ifr.ifr_ifindex = -1;
183 tmp = ioctl(sock_fd, SIOCGIFINDEX, &ifr);
184 close(sock_fd);
185 if (tmp >= 0)
186 /* In theory, we should redump the interface list
187 * to update our cache, this is left as an exercise
188 * to the reader... Jean II */
189 ret = ifr.ifr_ifindex;
190 }
191/* out:*/ 168/* out:*/
192 if (ret <= 0) 169 if (ret <= 0)
193 bb_error_msg_and_die("can't find device '%s'", name); 170 bb_error_msg_and_die("can't find device '%s'", name);