Making Coova Chilli not count local (server, not LAN) traffic

Timothy White timwhite88 at gmail.com
Wed Aug 5 06:51:53 UTC 2009


I apologise in advance if I break any list etiquettes for this list.

I'm basically tired of waiting for a feature to be added, so I'm going
to work on adding it myself, or at least trying to. (It's been a long
time since I did any C programming, so I'm a best rusty).
Having never worked on the Chilli code, I'm not 100% sure how it
works. From my brief look at the code, chilli.c around line 1464 is
where the actual "accounting" happens, in the cb_tun_ind function I
think. I'm not 100% sure on this at all though.

Can someone who knows the code let me know if that is actually where
the accounting of data happens? From what I can see ether
appconn->s_state.output_packets or appconn->s_state.input_packets is
increased for each packet, and the associated octets count depending
on whether it's in or out. So this suggests to me that I can just wrap
that small bit of code with an if statement that checks ip address and
ports, and not count traffic to and from the local server.
It also appears to my untrained eye, that while it's not supposed to
count traffic to and from the "uam" service on 3990, it still does
count it, so here would be a chance to fix that too.

The if statement would look like this.

  if ( ! (ipph->saddr  == options()->uamlisten.s_addr &&
	  (ipph->sport == htons(options()->uamport) ||
	   ipph->sport == htons(options()->uamuiport)))) {

You'd also set uamuiport in your config files to be what ever port
your local webserver runs on. (I have also noticed that wwwui exists
in the Changelog but can't be found anywhere else.)

I haven't had a chance to test the code (being at Uni atm, and not
near my testing box), so I'll test it when I get home and have a try.
If it works, I'll submit the patch.

If I'm totally off track, can someone please point me in the correct
direction to where the accounting happens, so I can poke around the
code and try and work out how to get it to not count local server
traffic.

Hope I can "code" this feature and fix what to me and a few others is a bug.

I'm open to criticism as long as it's constructive to fixing problems
and not cutting down. I am a programmer, but have a lot to learn so
any chance to learn I'll take.

Tim White
http://weirdo.bur.st/
http://purewhite.id.au/



More information about the Chilli mailing list