mldonkey-bugs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mldonkey-bugs] [bugs #12471] Add ToS support


From: Mark Schreiber
Subject: [Mldonkey-bugs] [bugs #12471] Add ToS support
Date: Sat, 26 Mar 2005 20:19:14 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050323 Firefox/1.0.2 Fedora/1.0.2-1.3.1

URL:
  <http://savannah.nongnu.org/bugs/?func=detailitem&item_id=12471>

                 Summary: Add ToS support
                 Project: mldonkey, a multi-networks file-sharing client
            Submitted by: mark7
            Submitted on: Sat 03/26/2005 at 20:19
                Category: Core
                Severity: 3 - Normal
              Item Group: Feature request
                  Status: None
                 Privacy: Private
             Assigned to: None
             Open/Closed: Open
                 Release: None
                 Release: 
        Platform Version: None
         Binaries Origin: None
                CPU type: None

    _______________________________________________________

Details:

IP provides a mechanism for flagging packets as Maximize-Throughput (bulk) or
Minimize-Latency (interactive).  If applications that "soak up extra
bandwidth" flag their packets as bulk, it can be extremely useful for
bandwidth allocation on residential ADSL or cable routers, and allow users to
run P2P 24/7 using *all* available extra bandwidth -- web browsing and the
like is not affected by P2P use.

Mldonkey could provide the option to flag all of its connections as bulk. 
The main problem is that the current version of ocaml does not expose the
required flags.

In C, flagging connections as bulk is done with these simple two lines of
code:

int tos = IPTOS_THROUGHPUT;
setsockopt(sock, IPPROTO_IP, IP_TOS, (char *)&tos, sizeof(tos));

IPPROTO_IP and IP_TOS are not exposed by ocaml, so mldonkey cannot use this
line.

A fix would entail adding IPPTORO_IP and IP_TOS to ocaml, and then locating
all the places that sockets are created in mldonkey and setting them to bulk
(if the user so desires).

Those mldonkey users who are on Linux boxes can enjoy this functionality
already, without application-level support.  The following configuration
should work nicely out-of-box for those of you with a single computer (no
NATTing routers set up or anything fancy like that) connected to an ADSL or
cable line:

Simply use the following commands:

groupadd mlnet
chgrp mlnet mlnet (in the mldonkey directory, as root)
chmod g+s mlnet (in the mldonkey directory, as root)

Then use the following script (adjust the variables at the top to fit your
particular configuration):

#!/bin/bash

DEV=eth0

RATE=370kbit
HIGH_RATE=200kbit
MED_RATE=100kbit
LOW_RATE=20kbit

# if there are already traffic-shaping rules in place, this removes them
# this will print an error if they don't exist, but continue to work
tc qdisc del dev $DEV root

tc qdisc add dev $DEV root handle 1: htb default 20

# PARENT CLASS
tc class add dev $DEV parent 1: classid 1:1 htb rate $RATE

# CHILD CLASSES
tc class add dev $DEV parent 1:1 classid 1:10 htb rate $HIGH_RATE ceil $RATE
tc class add dev $DEV parent 1:1 classid 1:20 htb rate $MED_RATE ceil $RATE
quantum 1500
tc class add dev $DEV parent 1:1 classid 1:30 htb rate $LOW_RATE ceil $RATE
quantum 1500

# interactive
tc filter add dev $DEV parent 1: prio 1 protocol ip u32 match ip tos 0x10
0x18 flowid 1:10
# bulk
tc filter add dev $DEV parent 1: prio 1 protocol ip u32 match ip tos 0x08
0x18 flowid 1:30

# make p2p bulk
iptables -t mangle -A OUTPUT -m owner -p tcp --gid-owner mlnet -j TOS
--set-tos Maximize-Throughpu






    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?func=detailitem&item_id=12471>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]