kbr / fritzconnection

Python-Tool to communicate with the AVM Fritz!Box by the TR-064 protocol and the AHA-HTTP-Interface
MIT License
304 stars 59 forks source link

GetTotalBytesSent resets to 0 #20

Closed J3n50m4t closed 4 years ago

J3n50m4t commented 4 years ago

Today I discovered a reset of fritzstatus values bytes sent and bytes received v to 0, if it overcome around 4300 Megabytes. I cant precise this because 4300MB was the highest value I was able to monitor (just to much idle traffic)

I'm not sure if this is releated to this topic at all, as I debugged a bit and got the zero values directly as api response, but I still wantetd to discuss here before reporting it to avm.

kbr commented 4 years ago

According to the AVM documentation the TotalBytesReceived and TotalBytesSend datatype is ui4, which corresponds to 2*32 or about 4.31e9. So this seems to be an integer overrun in the box and not a bug (at least concerning the documentation).

J3n50m4t commented 4 years ago

(at least concerning the documentation)

Seems logic, but then I thing the name is miss leading. I expected to get the same values as I get in the UI. As I looked up the Documentation now, to my understanding this isn't possible?

kbr commented 4 years ago

If AVM decides to change to ui8 TR-064 will report the same numbers as the UI. It's up to AVM whether they like to change this. fritzconnection can handle ui8 with just a minor modification.

J3n50m4t commented 4 years ago

I've contacted AVM and will post their answer here, if I get one at all.

J3n50m4t commented 4 years ago

AVM replied:

Es sieht nach erster Einschätzung so aus. Allerdings kann aktuell keine abschließende Aussage getroffen werden, ob die Änderung noch wie vorgesehen in das kommende Release von FRITZ!OS einfließen kann.

Seems like its coming, maybe even in the next release

kbr commented 4 years ago

Thank you for the info. We should handle this once the change made it into FRITZ!OS.

seven0fx commented 4 years ago

The Counter overflows at 4_294_967_295 and will start at 0. After the 24h disconnect the Counter drops too. Have still to figure out the Logic behind this.

2020-02-16 03:55:05 2318108259  2622046157
2020-02-16 03:56:05 2318112115  2622048449
2020-02-16 03:57:05 127881021   248915455
2020-02-16 03:58:06 127889692   248925887

2020-02-17 03:54:02 1115439283  4045206749
2020-02-17 03:55:02 1115446183  4045208843
2020-02-17 03:56:02 162976221   309003435
2020-02-17 03:57:02 162979687   309005513

2020-02-18 03:52:58 824101195   3993833915
2020-02-18 03:53:59 824108209   3993835253
2020-02-18 03:54:59 183645760   344450756
2020-02-18 03:55:59 183648628   344452250
Valenski commented 4 years ago

AVM has already a 64-bit counter available in igdicfgSCPD.xml for WANCommonIF named NewX_AVM_DE_TotalBytesReceived64/ NewX_AVM_DE_TotalBytesSent64.

kbr commented 4 years ago

Indeed, AVM seems to provide this informations already by the 'GetAddonInfos' action (since 2017, according to the documentation). Thank you for the hint.

svenstaro commented 4 years ago

This probably also explains an a fluke that I keep observing where the rate becomes negative at some point:

from fritzconnection.lib.fritzstatus import FritzStatus
fc = FritzStatus()
while True:
    print(fc.str_transmission_rate)
    sleep(5)
('143.6 KB', '29.2 MB')
('58.3 KB', '12.0 MB')
('69.1 KB', '11.8 MB')
('129.2 KB', '24.6 MB')
('69.1 KB', '12.1 MB')
('138.5 KB', '26.7 MB')
('151.2 KB', '-826810950.0 bytes')
('22.3 KB', '3.5 MB')
('38.1 KB', '1.0 MB')
('49.5 KB', '2.4 MB')

Can easily be reproduced using my code and some downloading.