[BusyBox 0000980]: patch to avoid "broadcast +" syntax

Denis Vlasenko vda.linux at googlemail.com
Thu Nov 23 23:29:18 UTC 2006


Please do not trim CC.

On Thursday 23 November 2006 09:33, Roberto A. Foglietta wrote:
> 2006/11/22, Denis Vlasenko <vda.linux at googlemail.com>:
> > On Wednesday 22 November 2006 09:45, Roberto A. Foglietta wrote:
> > > BusyBox v1.1.2 (2006.11.21-14:23+0000) Built-in shell (ash)
>
> 
> > In other words: I do not see the problem yet. At least in current svn.
> 
>  At least works the same on your svn, with your libs, with your arch,

"my" svn? It's everyone's svn. Anyone can check out latest svn
(yes, there's a hint in this sentence). And approximately a dozen people
have write access to it.

"my" libc? Is it a crime to use glibc these days?

"my" arch? I'm on x86[_64], so what?

> and finally with your nic. In ppc 405 does not work and it did not on
> geode too, etc. etc.

nic is not relevant, I think.

>  Patch was made for 1.1.3 but ifconfig.c until 1.2.2.1 does not
> changed so much in the  between. Patch applys cleanly between 1.1.2
> and 1.2.2.1 and at least on my arch (ppc405),  with my system
> (windriver), and my nic it does some difference:
> 
> APPLAYED PATCH BUSYBOX 1.1.2
> 
> BusyBox v1.1.2 (2006.11.22-16:53+0000) Built-in shell (ash)
> Enter 'help' for a list of built-in commands.
> 
> # ifconfig eth0
> eth0      Link encap:Ethernet  HWaddr 00:0A:35:00:22:00
>           inet addr:172.16.240.123  Bcast:172.16.247.255  Mask:255.255.248.0
> 
> # ifconfig eth0 172.16.241.216
> # ifconfig eth0
> eth0      Link encap:Ethernet  HWaddr 00:0A:35:00:22:00
>           inet addr:172.16.241.216  Bcast:172.16.255.255  Mask:255.255.0.0
> 
> # ifconfig eth0 172.16.241.216 netmask 255.255.255.0
> #  ifconfig eth0
> eth0      Link encap:Ethernet  HWaddr 00:0A:35:00:22:00
>           inet addr:172.16.241.216  Bcast:172.16.241.255  Mask:255.255.255.0
> 
>  My patch is on this page http://bugs.busybox.net/view.php?id=980 and
> is not the same you sent me named as 44.patch. IMHO 44.patch does not
> applay at all at least in some version I tried.

I just tried 1.1.3 and it works for me too, without any patching.

I do want to fix busybox bugs, but it does not mean that I will apply
any random patch.

As a person with write access I have to be careful with what I put into
the tree. At least I need to make sure that I understand what this patch
exactly fixes, and does not introduce new bugs or cryptic code.

So far I was not able to extract this information from you.
I am trying to reproduce this supposedly buggy behavior but it works for me.
Should I mention that it took some effort to just extract testcase
from you?

+       while (!stop) {
+               if((p = *++argv)) {
+                       ;
+               } else
+               if(is_BROADCAST_able()) {
+                       p = "broadcast";
+                       stop = 1;
+               } else
+                       break;

Do you understand that busybox is not Obfuscated C contest?

+       while (!stop) {
+               p = *++argv;
+               if (!p) {
+                       if (!is_BROADCAST_able())
+                             break;
+                       p = "broadcast";
+                       stop = 1;
+               }

And finally. I applied your patch to 1.1.3, and then modified it
(added printf's like this):

                if(is_BROADCAST_able()) {
printf("p = broadcast\n");
                        p = "broadcast";
                        stop = 1;
                } else
....
                        if (*++argv == NULL) {
                                if(stop) {
printf("goto BROADCAST\n");
                                        goto BROADCAST;
                                }
...
                                                if (stop || (is_BROADCAST_plus() && is_BROADCAST_able())){
printf("setting BROADCAST\n");
                                                        /* + is special, meaning broadcast is derived. */
                                                        did_flags |= A_BROADCAST;
                                                        sai.sin_addr.s_addr = (~sai_netmask) | (sai_hostname & sai_netmask);
                                                } else


Than I executed the following test script:

# cat test
set -x
ip a f dev if
./busybox ifconfig if
./busybox ifconfig if 172.16.241.216
./busybox ifconfig if
./busybox ifconfig if 172.16.241.216 netmask 255.255.255.0
./busybox ifconfig if

# sh test
+ ip a f dev if
+ ./busybox ifconfig if
if        Link encap:Ethernet  HWaddr 00:16:17:6D:77:DB
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11148 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4300 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:6053828 (5.7 MiB)  TX bytes:393052 (383.8 KiB)
          Interrupt:16 Base address:0x4000

+ ./busybox ifconfig if 172.16.241.216
+ ./busybox ifconfig if
if        Link encap:Ethernet  HWaddr 00:16:17:6D:77:DB
          inet addr:172.16.241.216  Bcast:172.16.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11148 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4300 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:6053828 (5.7 MiB)  TX bytes:393052 (383.8 KiB)
          Interrupt:16 Base address:0x4000

+ ./busybox ifconfig if 172.16.241.216 netmask 255.255.255.0
p = broadcast
+ ./busybox ifconfig if
if        Link encap:Ethernet  HWaddr 00:16:17:6D:77:DB
          inet addr:172.16.241.216  Bcast:172.16.241.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11148 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4300 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:6053828 (5.7 MiB)  TX bytes:393052 (383.8 KiB)
          Interrupt:16 Base address:0x4000

It is obvious that your patch fails to trigger automatic bcast recalculation
as you claim it does.

If you want to repeat my test, please find attached:

* .config
* ifconfig.c (modified as shown above)

Again, these files are for busybox 1.1.3
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.bz2
Type: application/x-bzip2
Size: 3329 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20061124/5f5b2b65/attachment-0004.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ifconfig.c.bz2
Type: application/x-bzip2
Size: 5543 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20061124/5f5b2b65/attachment-0005.bin 


More information about the busybox mailing list