On Thursday 07 August 2008 23:12, Wade Berrier wrote:
> Hi,
> 
> When using CONFIG_FEATURE_IFUPDOWN_IP, mac addresses from
> /etc/network/interfaces aren't being set correctly.  This is because
> of argument differences between ifconfig and 'ip'.
> 
> It is passed as:
> 
> ip link set address ether xx:xx:xx:xx:xx:xx eth0 up
> 
> when it should be:
> 
> ip link set address xx:xx:xx:xx:xx:xx eth0 up
> 
> Note: this is accordance to debian's interfaces format described here:
> http://www.annodex.net/cgi-bin/man/man2html?interfaces
> 
> The attached patch skips the 'ether' (or any other class) keyword so
> the arguments are correct.
> 
> Does it look ok?

Conceptually, yes.

                                if (varvalue) {
+#if ENABLE_FEATURE_IFUPDOWN_IP
+                                       /* 'ip' doesn't want the 'ether' 
keyword in hwaddress 
+                                        * like 'ifconfig' does.  Skip the 
keyword after hwaddress. */
+                                       if (strncmp(command, "hwaddress", 9) == 
0) {
+                                               char *skip_hw;
+                                               skip_hw = strchr(varvalue, ' ');
+                                               if (skip_hw != NULL) {
+                                                       while (*skip_hw == ' ' 
&& *skip_hw != '\0')

if *skip_hw == ' ', it's definitely != '\0'.

+                                                               skip_hw++;
+                                                       varvalue = skip_hw;
+                                               }
+                                       }
+#endif


I propose to write this more compactly like this:


                                if (varvalue) {
#if ENABLE_FEATURE_IFUPDOWN_IP
                                        /* "hwaddress <class> <address>":
                                         * unlike ifconfig, ip doesnt want 
<class>
                                         * (usually "ether" keyword). Skip it. 
*/
                                        if (strncmp(command, "hwaddress", 9) == 
0) {
                                                varvalue = 
skip_whitespace(skip_non_whitespace(varvalue));
                                        }
#endif
                                        addstr(&result, varvalue, 
strlen(varvalue));


I applied both your patches wit hsmall edits. Thanks!
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to