a defect in ipfw dummynet

bycn82 bycn82 at gmail.com
Sun May 25 04:11:24 UTC 2014


Ok, anyway, ignore it. :)

 

From: bycn82 [mailto:bycn82 at gmail.com] 
Sent: 25 May, 2014 1:09
To: Alexander V. Chernikov; Luigi Rizzo
Cc: FreeBSD Net
Subject: RE: a defect in ipfw dummynet

 

Hi ,

After I think it twice, I think the code and the document are OK, But the problem is from the examples/document on the internet,  Because the existing logic is not accurate. So users can use different measurements instead of these four which mentioned in the document.  For example most of time I would like to use `kbps` and `KBps`, (It is my fault, I did not follow the document, )

 

I would like to recommend to make some changes in the document only, 

 

Current document

bw    bandwidth | device

           Bandwidth,   measured in [K|M]{bit/s|Byte/s}.

 

Change to 

bw    bandwidth | device
           Bandwidth,   support 4 measurements,(Kbit/s, Mbit/s, KByte/s, MByte/s) all others are officially not recommended.

 

With this document, Some mistakes can be prevented . for example this one:

>ipfw pipe 1 config bw 1BIT/s

 

 

 

 

Best Regards,

Bycn82

 

 

From: bycn82 [mailto:bycn82 at gmail.com] 
Sent: 25 May, 2014 0:19
To: Alexander V. Chernikov; Luigi Rizzo
Cc: FreeBSD Net
Subject: a defect in ipfw dummynet

 

Hi Alexander,

 

Since you guys are working on the “named table” feature. So I have stopped implementing it using my way. Hence I got some time to read more about the existing codes.  This afternoon I just started to read the dummynet part, then I have another question to ask. Maybe it is not a small defect, Or just because there are some more story which I don’t know.  anyway.

 

For example,

when we run command as below, 

>ipfw pipe config 1 100kbps

the userspace program need to read the bandwidth value which is “100kbps”, And I found the code as below, 

                if ((*end == 'B' &&

                                _substrcmp2(end, "Bi", "Bit/s") != 0) ||

                                _substrcmp2(end, "by", "bytes") == 0)

                                bw *= 8;

 

Sure it works. But I want to ask  whether it can be more readable If we list down all the possibilities and directly “hard code” in the source, At least it can be more accurate. 

 

With current logic, we have change to  have below situation.

 

root at FB10Head:~ # ipfw pipe config 1 bw 1ByeBye                    <- the command will be considered as “1 Byte per second”

root at FB10Head:~ # ipfw pipe 1 show

00001:   8.000 bit/s     0 ms burst 0 

q131073  50 sl. 0 flows (1 buckets) sched 65537 weight 0 lmax 0 pri 0 droptail

sched 65537 type FIFO flags 0x0 0 buckets 0 active

root at FB10Head:~ #

 

 

 

 

 

Best Regards,

Bycn82

 



More information about the freebsd-net mailing list