List of commits:
Subject Hash Author Date (UTC)
Added MSS. 9a5c3676567cb92e6c0b4106c2b97cd2da2273a5 Catalin(ux) M. BOIE 2010-12-14 17:00:37
Added TOS test script. a4b1b05b27b3eaa06a4a71f656e1b80731d1b8ff Catalin(ux) M. BOIE 2010-12-14 16:55:03
Ignore Changelog-last file. 1bfa5decd11f4fd95e4b002d88e2a2e04c747855 Catalin(ux) M. BOIE 2010-12-14 16:54:36
Added KA. ec9b4556e51ca9a807400910f8ca6d698f9ad670 Catalin(ux) M. BOIE 2010-12-14 16:53:58
Bump up the version to 0.5. f7ba7f0feb49ac4942d85903d31e085f1ffa6149 Catalin(ux) M. BOIE 2010-11-07 23:16:25
Duilder updates. 4d3691f340591f68f9b0ae704da24b4352957f05 Catalin(ux) M. BOIE 2010-11-07 23:15:29
Added support to force TOS by using env var FORCE_NET_TOS. 319cfbee315a0c6889791b122fdb8069aa2ffdf1 Catalin(ux) M. BOIE 2010-11-07 23:14:23
No need for duilder_release. I will use a global one. 15a59294aa3922e58bff8aaa9de7cc06dc44fe1e Catalin(ux) M. BOIE 2010-10-27 20:43:15
TODO in. 9ea8407b8a2767debcf7597bbfc1bddfe44c78eb Catalin(ux) M. BOIE 2010-10-27 20:21:13
Typo. 2282d895e91cf2b02a7b67d933af2c68db5798b6 Catalin(ux) M. BOIE 2010-10-27 19:54:40
Aded license information to README file. fe8071fd2d9f912136fb7fa22f289ddc63cf0f14 Catalin(ux) M. BOIE 2010-10-27 19:46:48
Improved description. 1f17958175bf3f2a656a365fdafca21118737cf1 Catalin(ux) M. BOIE 2010-10-27 19:43:33
Silence compiler useless warning. 117e169b70197ac7e62907f855eb475a0a43fe07 Catalin(ux) M. BOIE 2010-10-27 19:24:45
Bump up the version to 0.4. 59371ee292d38d489719f105a9ff16c923be09d0 Catalin(ux) M. BOIE 2010-10-27 19:16:53
Corrected documentation. cf9d535fcb9d433b8a66c3c5283d9d9d64ae7240 Catalin(ux) M. BOIE 2010-10-27 19:16:29
Nothing to install in /usr/bin! d6eecf1bb4cfcf3d4bc08d8e87cac05f567fd51c Catalin(ux) M. BOIE 2010-10-27 19:13:54
Bump version to 0.3. 3531182e79370861cf73083948494eb4a8ced776 Catalin(ux) M. BOIE 2010-10-27 19:13:01
Store latest version/revision into LATEST_VER/REV for easy web update. 2d3036b2a52f2825cb7be39dc3039c0c6637b4f0 Catalin(ux) M. BOIE 2010-10-27 13:03:22
Fixed install command. 85e4aa9778fa4f10df5f313aff4444f7ec1d2619 Catalin(ux) M. BOIE 2010-10-27 12:29:47
First version. 2d1ffe53a6cfd146f91157baeadb101a59fdd556 Catalin(ux) M. BOIE 2010-10-27 12:21:37
Commit 9a5c3676567cb92e6c0b4106c2b97cd2da2273a5 - Added MSS.
Signed-off-by: Catalin(ux) M. BOIE <catab@embedromix.ro>
Author: Catalin(ux) M. BOIE
Author date (UTC): 2010-12-14 17:00
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2010-12-19 19:37
Parent(s): a4b1b05b27b3eaa06a4a71f656e1b80731d1b8ff
Signing key:
Tree: 9664aa004d8bcffce0265399054108201b9ed13e
File Lines added Lines deleted
force_bind.c 28 0
test_mss1.sh 7 0
File force_bind.c changed (mode: 100644) (index 2e5a072..7933eb5)
... ... static char *force_address = NULL;
39 39 static int force_port = -1; static int force_port = -1;
40 40 static unsigned int set_tos = 0, tos; static unsigned int set_tos = 0, tos;
41 41 static unsigned int set_keepalive = 0, keepalive; static unsigned int set_keepalive = 0, keepalive;
42 static unsigned int force_mss = 0, mss;
43
42 44
43 45 /* Functions */ /* Functions */
44 46
 
... ... static void set_ka_idle(int sock)
60 62 keepalive, ret); keepalive, ret);
61 63 } }
62 64
65 static void set_mss(int sock)
66 {
67 int ret;
68
69 ret = old_setsockopt(sock, IPPROTO_TCP, TCP_MAXSEG, &mss, sizeof(mss));
70 syslog(LOG_INFO, "force_bind: changing TCP_MAXSEG to %u (ret=%d).\n",
71 mss, ret);
72 }
73
63 74 void init(void) void init(void)
64 75 { {
65 76 static unsigned char inited = 0; static unsigned char inited = 0;
 
... ... void init(void)
102 113 keepalive); keepalive);
103 114 } }
104 115
116 /* mss */
117 x = getenv("FORCE_NET_MSS");
118 if (x != NULL) {
119 force_mss = 1;
120 mss = strtoul(x, NULL, 0);
121 syslog(LOG_INFO, "force_bind: Force MSS to %u.\n",
122 mss);
123 }
124
105 125 old_bind = dlsym(RTLD_NEXT, "bind"); old_bind = dlsym(RTLD_NEXT, "bind");
106 126 if (old_bind == NULL) { if (old_bind == NULL) {
107 127 syslog(LOG_ERR, "force_bind: Cannot resolve 'bind'!\n"); syslog(LOG_ERR, "force_bind: Cannot resolve 'bind'!\n");
 
... ... int setsockopt(int sockfd, int level, int optname, const void *optval,
195 215 set_ka_idle(sockfd); set_ka_idle(sockfd);
196 216 return 0; return 0;
197 217 } }
218
219 if ((optname == TCP_MAXSEG) && (force_mss == 1)) {
220 set_mss(sockfd);
221 return 0;
222 }
198 223 } }
199 224
200 225 return old_setsockopt(sockfd, level, optname, optval, optlen); return old_setsockopt(sockfd, level, optname, optval, optlen);
 
... ... int socket(int domain, int type, int protocol)
223 248 set_ka_idle(sock); set_ka_idle(sock);
224 249 } }
225 250
251 if (force_mss == 1)
252 set_mss(sock);
253
226 254 return sock; return sock;
227 255 } }
228 256
File test_mss1.sh added (mode: 100755) (index 0000000..2f0bf21)
1 #!/bin/sh
2
3 export FORCE_NET_MSS=1280
4
5 export LD_PRELOAD="${LD_PRELOAD}:./force_bind.so"
6
7 strace -s100 -o "${0}.strace" ./test_bind "$@"
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/catalinux/force_bind

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/catalinux/force_bind

Clone this repository using git:
git clone git://git.rocketgit.com/user/catalinux/force_bind

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main