On Fri, Oct 30, 2015 at 09:25:43AM +0000, ??????????????? wrote:
> if i manually modify source code and simply set tos directly. where should
> i add it.
> now I'm adding:
>
> # tcp_proto.c, tcp_connect_server, line 513 - 514.
>
> 511 if (global.tune.server_rcvbuf)
> 512 setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &global.tune.server_rcvbuf,
> sizeof(global.tune.server_rcvbuf));
> 513 int tos=0x10;
> 514 setsockopt(fd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos));
> 515 if ((connect(fd, (struct sockaddr *)&conn->addr.to, get_addr_len(&conn->
> addr.to)) == -1) &&
>
> is it correct? seems it works now, but i don't know if it will cause other
> problem.
Yes that's it.
> my goal is make all backend side connection have a specific TOS field. for
> policy routing like this:
> # ip route add default via 10.1.0.1 tos 0x10.
Then you may have alternate options, you can use the "source" parameter
on servers to change the source (which will be usable from ip rule to
match the table you want), or even "interface" to specify an interface
(and possibly pick the correct route).
Your point is interesting because it tends to indicate that for your
case, a static setting per-server would make more sense than a dynamic
setting. Maybe you should add a per-server "set-tos" and "set-mark"
settings.
Willy
> if i manually modify source code and simply set tos directly. where should
> i add it.
> now I'm adding:
>
> # tcp_proto.c, tcp_connect_server, line 513 - 514.
>
> 511 if (global.tune.server_rcvbuf)
> 512 setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &global.tune.server_rcvbuf,
> sizeof(global.tune.server_rcvbuf));
> 513 int tos=0x10;
> 514 setsockopt(fd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos));
> 515 if ((connect(fd, (struct sockaddr *)&conn->addr.to, get_addr_len(&conn->
> addr.to)) == -1) &&
>
> is it correct? seems it works now, but i don't know if it will cause other
> problem.
Yes that's it.
> my goal is make all backend side connection have a specific TOS field. for
> policy routing like this:
> # ip route add default via 10.1.0.1 tos 0x10.
Then you may have alternate options, you can use the "source" parameter
on servers to change the source (which will be usable from ip rule to
match the table you want), or even "interface" to specify an interface
(and possibly pick the correct route).
Your point is interesting because it tends to indicate that for your
case, a static setting per-server would make more sense than a dynamic
setting. Maybe you should add a per-server "set-tos" and "set-mark"
settings.
Willy