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

Timothy White timwhite88 at gmail.com
Sat Aug 8 14:49:11 UTC 2009


Ok, some testing done.
Apparently setting uamuiport doesn't play so nicely if something is
already running on that port (like apache). It's fine if you are going
to have an inetd style webserver launched via chilli, but not so good
otherwise.
But, I am at the right part of the code. Essentially, we could add a
bit more code that lists a number of ports to the local server, that
shouldn't be counted or "leaky bucketed". For now, I've just added one
port, and hard coded it in, port 80. But adding it as a list of ports,
and not hard coded but configurable on the command line and config
files, shouldn't be too much harder.

I've attached my patch.

Tim

On Wed, Aug 5, 2009 at 2:51 PM, Timothy White<timwhite88 at gmail.com> wrote:
> 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/
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: chilli.c.diff
Type: text/x-patch
Size: 935 bytes
Desc: not available
URL: <http://lists.coova.org/pipermail/chilli/attachments/20090808/d284a7cc/attachment.bin>


More information about the Chilli mailing list