[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-wget] [PATCH] add support for SO_MARK: --so-mark
From: |
Alban Crequy |
Subject: |
[Bug-wget] [PATCH] add support for SO_MARK: --so-mark |
Date: |
Tue, 28 Jan 2014 22:28:00 +0000 |
I'm not sure this is a feature that wget would want, but it was uselful to me
for testing traffic control.
---
src/connect.c | 6 ++++++
src/init.c | 1 +
src/main.c | 1 +
src/options.h | 2 ++
4 files changed, 10 insertions(+)
diff --git a/src/connect.c b/src/connect.c
index bfb079b..b0341f3 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -320,6 +320,12 @@ connect_to_ip (const ip_address *ip, int port, const char
*print)
}
#endif
+ if (opt.so_mark)
+ {
+ setsockopt (sock, SOL_SOCKET, SO_MARK,
+ (void *)&opt.so_mark, (socklen_t)sizeof (opt.so_mark));
+ }
+
/* For very small rate limits, set the buffer size (and hence,
hopefully, the kernel's TCP window size) to the per-second limit.
That way we should never have to sleep for more than 1s between
diff --git a/src/init.c b/src/init.c
index 43d5ae9..cdfc694 100644
--- a/src/init.c
+++ b/src/init.c
@@ -270,6 +270,7 @@ static const struct {
#endif
{ "serverresponse", &opt.server_response, cmd_boolean },
{ "showalldnsentries", &opt.show_all_dns_entries, cmd_boolean },
+ { "somark", &opt.so_mark, cmd_number },
{ "spanhosts", &opt.spanhost, cmd_boolean },
{ "spider", &opt.spider, cmd_boolean },
{ "strictcomments", &opt.strict_comments, cmd_boolean },
diff --git a/src/main.c b/src/main.c
index 2aa961d..cf141ed 100644
--- a/src/main.c
+++ b/src/main.c
@@ -280,6 +280,7 @@ static struct cmdline_option option_data[] =
{ "save-headers", 0, OPT_BOOLEAN, "saveheaders", -1 },
{ IF_SSL ("secure-protocol"), 0, OPT_VALUE, "secureprotocol", -1 },
{ "server-response", 'S', OPT_BOOLEAN, "serverresponse", -1 },
+ { "so-mark", 0, OPT_VALUE, "somark", -1 },
{ "span-hosts", 'H', OPT_BOOLEAN, "spanhosts", -1 },
{ "spider", 0, OPT_BOOLEAN, "spider", -1 },
{ "strict-comments", 0, OPT_BOOLEAN, "strictcomments", -1 },
diff --git a/src/options.h b/src/options.h
index e00fadc..41c64ba 100644
--- a/src/options.h
+++ b/src/options.h
@@ -285,6 +285,8 @@ struct options
bool show_all_dns_entries; /* Show all the DNS entries when resolving a
name. */
bool report_bps; /*Output bandwidth in bits format*/
+
+ int so_mark; /* use SO_MARK */
};
extern struct options opt;
--
1.8.5.3
- [Bug-wget] [PATCH] add support for SO_MARK: --so-mark,
Alban Crequy <=