* [PATCH] SO_ORIGINAL_DST for getsockopt() in SCTP
@ 2009-07-03 0:26 Rafael Laufer
2009-07-03 1:40 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Rafael Laufer @ 2009-07-03 0:26 UTC (permalink / raw)
To: netfilter-devel
Hi,
a tiny kernel patch to allow getsockopt() with SO_ORIGINAL_DST to work
for SCTP:
diff -rup
linux-2.6.28.orig/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
linux-2.6.28/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
--- linux-2.6.28.orig/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
2008-12-24 15:26:37.000000000 -0800
+++ linux-2.6.28/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
2009-07-02 17:07:09.000000000 -0700
@@ -258,11 +258,11 @@ getorigdst(struct sock *sk, int optval,
tuple.dst.u3.ip = inet->daddr;
tuple.dst.u.tcp.port = inet->dport;
tuple.src.l3num = PF_INET;
- tuple.dst.protonum = IPPROTO_TCP;
+ tuple.dst.protonum = sk->sk_protocol;
- /* We only do TCP at the moment: is there a better way? */
- if (strcmp(sk->sk_prot->name, "TCP")) {
- pr_debug("SO_ORIGINAL_DST: Not a TCP socket\n");
+ /* We only do TCP and SCTP at the moment: is there a better way? */
+ if ((sk->sk_protocol != IPPROTO_TCP) && (sk->sk_protocol !=
IPPROTO_SCTP)) {
+ pr_debug("SO_ORIGINAL_DST: Not a TCP/SCTP socket\n");
return -ENOPROTOOPT;
}
Rafael
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] SO_ORIGINAL_DST for getsockopt() in SCTP
2009-07-03 0:26 [PATCH] SO_ORIGINAL_DST for getsockopt() in SCTP Rafael Laufer
@ 2009-07-03 1:40 ` David Miller
2009-07-03 2:26 ` Rafael Laufer
0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2009-07-03 1:40 UTC (permalink / raw)
To: rlaufer; +Cc: netfilter-devel
Thunderbird has severely mangled your patch beyond usability.
Please read Documentation/email-clients.txt in the kernel sources.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] SO_ORIGINAL_DST for getsockopt() in SCTP
2009-07-03 1:40 ` David Miller
@ 2009-07-03 2:26 ` Rafael Laufer
2009-07-03 3:01 ` David Miller
2009-08-10 8:09 ` Patrick McHardy
0 siblings, 2 replies; 5+ messages in thread
From: Rafael Laufer @ 2009-07-03 2:26 UTC (permalink / raw)
To: David Miller; +Cc: netfilter-devel
David Miller wrote:
> Thunderbird has severely mangled your patch beyond usability.
>
> Please read Documentation/email-clients.txt in the kernel sources.
Trying again:
diff -rup linux-2.6.28.orig/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c linux-2.6.28/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
--- linux-2.6.28.orig/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c 2008-12-24 15:26:37.000000000 -0800
+++ linux-2.6.28/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c 2009-07-02 17:07:09.000000000 -0700
@@ -258,11 +258,11 @@ getorigdst(struct sock *sk, int optval,
tuple.dst.u3.ip = inet->daddr;
tuple.dst.u.tcp.port = inet->dport;
tuple.src.l3num = PF_INET;
- tuple.dst.protonum = IPPROTO_TCP;
+ tuple.dst.protonum = sk->sk_protocol;
- /* We only do TCP at the moment: is there a better way? */
- if (strcmp(sk->sk_prot->name, "TCP")) {
- pr_debug("SO_ORIGINAL_DST: Not a TCP socket\n");
+ /* We only do TCP and SCTP at the moment: is there a better way? */
+ if ((sk->sk_protocol != IPPROTO_TCP) && (sk->sk_protocol != IPPROTO_SCTP)) {
+ pr_debug("SO_ORIGINAL_DST: Not a TCP/SCTP socket\n");
return -ENOPROTOOPT;
}
Rafael
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] SO_ORIGINAL_DST for getsockopt() in SCTP
2009-07-03 2:26 ` Rafael Laufer
@ 2009-07-03 3:01 ` David Miller
2009-08-10 8:09 ` Patrick McHardy
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2009-07-03 3:01 UTC (permalink / raw)
To: rlaufer; +Cc: netfilter-devel
From: Rafael Laufer <rlaufer@cs.ucla.edu>
Date: Thu, 02 Jul 2009 19:26:57 -0700
> David Miller wrote:
>> Thunderbird has severely mangled your patch beyond usability.
>>
>> Please read Documentation/email-clients.txt in the kernel sources.
>
> Trying again:
You should make your new posting with full changelog
and signoffs so that whoever applies this doesn't have
to go searching into the mailing list archives just
to hunt that down.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] SO_ORIGINAL_DST for getsockopt() in SCTP
2009-07-03 2:26 ` Rafael Laufer
2009-07-03 3:01 ` David Miller
@ 2009-08-10 8:09 ` Patrick McHardy
1 sibling, 0 replies; 5+ messages in thread
From: Patrick McHardy @ 2009-08-10 8:09 UTC (permalink / raw)
To: Rafael Laufer; +Cc: David Miller, netfilter-devel
Rafael Laufer wrote:
> David Miller wrote:
>> Thunderbird has severely mangled your patch beyond usability.
>>
>> Please read Documentation/email-clients.txt in the kernel sources.
>
> Trying again:
>
>
> diff -rup linux-2.6.28.orig/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c linux-2.6.28/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
> --- linux-2.6.28.orig/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c 2008-12-24 15:26:37.000000000 -0800
> +++ linux-2.6.28/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c 2009-07-02 17:07:09.000000000 -0700
> @@ -258,11 +258,11 @@ getorigdst(struct sock *sk, int optval,
> tuple.dst.u3.ip = inet->daddr;
> tuple.dst.u.tcp.port = inet->dport;
> tuple.src.l3num = PF_INET;
> - tuple.dst.protonum = IPPROTO_TCP;
> + tuple.dst.protonum = sk->sk_protocol;
>
> - /* We only do TCP at the moment: is there a better way? */
> - if (strcmp(sk->sk_prot->name, "TCP")) {
> - pr_debug("SO_ORIGINAL_DST: Not a TCP socket\n");
> + /* We only do TCP and SCTP at the moment: is there a better way? */
> + if ((sk->sk_protocol != IPPROTO_TCP) && (sk->sk_protocol != IPPROTO_SCTP)) {
> + pr_debug("SO_ORIGINAL_DST: Not a TCP/SCTP socket\n");
> return -ENOPROTOOPT;
> }
Applied with minor stylistic changes.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-08-10 8:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-03 0:26 [PATCH] SO_ORIGINAL_DST for getsockopt() in SCTP Rafael Laufer
2009-07-03 1:40 ` David Miller
2009-07-03 2:26 ` Rafael Laufer
2009-07-03 3:01 ` David Miller
2009-08-10 8:09 ` Patrick McHardy
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).