* [net-next-2.6 PATCH 1/4 revised] TCPCT part 1a: extend struct tcp_request_sock
@ 2009-10-16 17:39 William Allen Simpson
2009-10-18 15:57 ` William Allen Simpson
0 siblings, 1 reply; 2+ messages in thread
From: William Allen Simpson @ 2009-10-16 17:39 UTC (permalink / raw)
To: Linux Kernel Network Developers
[-- Attachment #1: Type: text/plain, Size: 489 bytes --]
Pass additional parameters associated with sending SYNACK. This
is not as straightforward or architecturally clean as previously
proposed, and has the unfortunate side effect of potentially
including otherwise unneeded headers for related protocols, but
that problem will affect very few files.
---
include/net/extend_request_sock.h | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
create mode 100644 include/net/extend_request_sock.h
[-- Attachment #2: TCPCT+1+1.patch --]
[-- Type: text/plain, Size: 1247 bytes --]
diff --git a/include/net/extend_request_sock.h b/include/net/extend_request_sock.h
new file mode 100644
index 0000000..c991af9
--- /dev/null
+++ b/include/net/extend_request_sock.h
@@ -0,0 +1,37 @@
+#ifndef _EXTEND_REQUEST_SOCK_H
+#define _EXTEND_REQUEST_SOCK_H
+/*
+ * Short term extension of struct tcp_request_sock and related.
+ *
+ * Copyright (C) 2009 William.Allen.Simpson@gmail.com
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#include <linux/tcp.h>
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
+#include <linux/ipv6.h>
+#endif
+
+struct extend_request_sock {
+ union {
+ struct tcp_request_sock tcp4rsk;
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
+ struct tcp6_request_sock tcp6rsk;
+#endif
+ } header;
+
+ u8 cookie_plus;
+ u8 cookie_in_always:1,
+ cookie_out_never:1;
+};
+
+static inline struct extend_request_sock *ext_rsk(const struct request_sock *req)
+{
+ return (struct extend_request_sock *)req;
+}
+
+#endif /* _EXTEND_REQUEST_SOCK_H */
--
1.6.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [net-next-2.6 PATCH 1/4 revised] TCPCT part 1a: extend struct tcp_request_sock
2009-10-16 17:39 [net-next-2.6 PATCH 1/4 revised] TCPCT part 1a: extend struct tcp_request_sock William Allen Simpson
@ 2009-10-18 15:57 ` William Allen Simpson
0 siblings, 0 replies; 2+ messages in thread
From: William Allen Simpson @ 2009-10-18 15:57 UTC (permalink / raw)
To: Linux Kernel Network Developers
William Allen Simpson wrote:
> Pass additional parameters associated with sending SYNACK. This
> is not as straightforward or architecturally clean as previously
> proposed, and has the unfortunate side effect of potentially
> including otherwise unneeded headers for related protocols, but
> that problem will affect very few files.
> ---
> include/net/extend_request_sock.h | 37
> +++++++++++++++++++++++++++++++++++++
> 1 files changed, 37 insertions(+), 0 deletions(-)
> create mode 100644 include/net/extend_request_sock.h
>
This technique appears to be unworkable:
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 9971870..30c4808 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -71,6 +71,7 @@
#include <net/timewait_sock.h>
#include <net/xfrm.h>
#include <net/netdma.h>
+#include <net/extend_request_sock.h>
#include <linux/inet.h>
#include <linux/ipv6.h>
@@ -1195,6 +1196,15 @@ struct request_sock_ops tcp_request_sock_ops __read_mostly = {
.send_reset = tcp_v4_send_reset,
};
+struct request_sock_ops tcp4_extend_request_sock_ops __read_mostly = {
+ .family = PF_INET,
+ .obj_size = sizeof(struct extend_request_sock),
+ .rtx_syn_ack = tcp_v4_send_synack,
+ .send_ack = tcp_v4_reqsk_send_ack,
+ .destructor = tcp_v4_reqsk_destructor,
+ .send_reset = tcp_v4_send_reset,
+};
+
...
+ req = inet_reqsk_alloc(&tcp4_extend_request_sock_ops);
+ if (NULL == req)
+ goto drop;
+
Many hours of investigation demonstrated that the obj_size isn't actually
used to allocate the structure. Heck, it's not even checked to determine
whether there's enough room! Instead, the kernel crashes later, as the
extended variables are accessed!
Returning to the architecturally clean parameters of the previous patch
series, that has the distinct advantage of actually working....
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-10-18 15:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-16 17:39 [net-next-2.6 PATCH 1/4 revised] TCPCT part 1a: extend struct tcp_request_sock William Allen Simpson
2009-10-18 15:57 ` William Allen Simpson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).