linux/net/ipv6
Ilpo Järvinen 81ada62d70 tcpv6: convert opt[] -> topt in tcp_v6_send_reset
after this I get:

$ diff-funcs tcp_v6_send_reset tcp_ipv6.c tcp_ipv6.c tcp_v6_send_ack
 --- tcp_ipv6.c:tcp_v6_send_reset()
 +++ tcp_ipv6.c:tcp_v6_send_ack()
@@ -1,4 +1,5 @@
-static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
+static void tcp_v6_send_ack(struct sk_buff *skb, u32 seq, u32 ack, u32 win,
u32 ts,
+                           struct tcp_md5sig_key *key)
 {
        struct tcphdr *th = tcp_hdr(skb), *t1;
        struct sk_buff *buff;
@@ -7,31 +8,14 @@
        struct sock *ctl_sk = net->ipv6.tcp_sk;
        unsigned int tot_len = sizeof(struct tcphdr);
        __be32 *topt;
-#ifdef CONFIG_TCP_MD5SIG
-       struct tcp_md5sig_key *key;
-#endif
-
-       if (th->rst)
-               return;
-
-       if (!ipv6_unicast_destination(skb))
-               return;

+       if (ts)
+               tot_len += TCPOLEN_TSTAMP_ALIGNED;
 #ifdef CONFIG_TCP_MD5SIG
-       if (sk)
-               key = tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->daddr);
-       else
-               key = NULL;
-
        if (key)
                tot_len += TCPOLEN_MD5SIG_ALIGNED;
 #endif

-       /*
-        * We need to grab some memory, and put together an RST,
-        * and then put it into the queue to be sent.
-        */
-
        buff = alloc_skb(MAX_HEADER + sizeof(struct ipv6hdr) + tot_len,
                         GFP_ATOMIC);
        if (buff == NULL)
@@ -46,18 +30,20 @@
        t1->dest = th->source;
        t1->source = th->dest;
        t1->doff = tot_len / 4;
-       t1->rst = 1;
-
-       if(th->ack) {
-               t1->seq = th->ack_seq;
-       } else {
-               t1->ack = 1;
-               t1->ack_seq = htonl(ntohl(th->seq) + th->syn + th->fin
-                                   + skb->len - (th->doff<<2));
-       }
+       t1->seq = htonl(seq);
+       t1->ack_seq = htonl(ack);
+       t1->ack = 1;
+       t1->window = htons(win);

        topt = (__be32 *)(t1 + 1);

+       if (ts) {
+               *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
+                               (TCPOPT_TIMESTAMP << 8) |
TCPOLEN_TIMESTAMP);
+               *topt++ = htonl(tcp_time_stamp);
+               *topt++ = htonl(ts);
+       }
+
 #ifdef CONFIG_TCP_MD5SIG
        if (key) {
                *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
@@ -84,15 +70,10 @@
        fl.fl_ip_sport = t1->source;
        security_skb_classify_flow(skb, &fl);

-       /* Pass a socket to ip6_dst_lookup either it is for RST
-        * Underlying function will use this to retrieve the network
-        * namespace
-        */
        if (!ip6_dst_lookup(ctl_sk, &buff->dst, &fl)) {
                if (xfrm_lookup(&buff->dst, &fl, NULL, 0) >= 0) {
                        ip6_xmit(ctl_sk, buff, &fl, NULL, 0);
                        TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS);
-                       TCP_INC_STATS_BH(net, TCP_MIB_OUTRSTS);
                        return;
                }
        }


...which starts to be trivial to combine.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-10-09 14:42:01 -07:00
..
netfilter netfilter: xtables: provide invoked family value to extensions 2008-10-08 11:35:20 +02:00
addrconf_core.c
addrconf.c ipv6: protocol for address routes 2008-08-23 05:16:46 -07:00
addrlabel.c
af_inet6.c ipv6: remove unused not init_ipv6_mibs/cleanup_ipv6_mibs 2008-10-08 11:17:07 -07:00
ah6.c
anycast.c
datagram.c IPv6: datagram_send_ctl() should exit immediately when an error occured 2008-07-29 23:57:58 -07:00
esp6.c ipsec: Interfamily IPSec BEET, ipv4-inner ipv6-outer 2008-08-06 02:40:25 -07:00
exthdrs_core.c
exthdrs.c ipv6: added net argument to IP6_INC_STATS_BH 2008-10-08 11:09:27 -07:00
fib6_rules.c netns: Add network namespace argument to rt6_fill_node() and ipv6_dev_get_saddr() 2008-08-14 15:33:21 -07:00
icmp.c ipv6: added net argument to ICMP6MSGIN_INC_STATS_BH 2008-10-08 11:15:46 -07:00
inet6_connection_sock.c net: convert BUG_TRAP to generic WARN_ON 2008-07-25 21:43:18 -07:00
inet6_hashtables.c net: convert BUG_TRAP to generic WARN_ON 2008-07-25 21:43:18 -07:00
ip6_fib.c netns: Add network namespace argument to rt6_fill_node() and ipv6_dev_get_saddr() 2008-08-14 15:33:21 -07:00
ip6_flowlabel.c
ip6_input.c ipv6: added net argument to IP6_INC_STATS_BH 2008-10-08 11:09:27 -07:00
ip6_output.c ipv6: added net argument to ICMP6MSGOUT_INC_STATS_BH 2008-10-08 11:15:05 -07:00
ip6_tunnel.c net: Use hton[sl]() instead of __constant_hton[sl]() where applicable 2008-09-20 22:20:49 -07:00
ip6mr.c ipv6: added net argument to IP6_INC_STATS_BH 2008-10-08 11:09:27 -07:00
ipcomp6.c ipcomp: Fix warnings after ipcomp consolidation. 2008-07-27 03:59:24 -07:00
ipv6_sockglue.c ipv6: Fix the return interface index when get it while no message is received. 2008-08-17 23:21:52 -07:00
Kconfig ipsec: ipcomp - Merge IPComp implementations 2008-07-25 02:54:40 -07:00
Makefile [IPV6] MROUTE: Support multicast forwarding. 2008-04-05 22:33:38 +09:00
mcast.c ipv6: added net argument to ICMP6MSGOUT_INC_STATS_BH 2008-10-08 11:15:05 -07:00
mip6.c net: convert BUG_TRAP to generic WARN_ON 2008-07-25 21:43:18 -07:00
ndisc.c ipv6: added net argument to ICMP6MSGOUT_INC_STATS 2008-10-08 11:14:44 -07:00
netfilter.c netns: add net parameter to IP6_INC_STATS 2008-10-08 10:54:51 -07:00
proc.c ipv6: making ip and icmp statistics per/namespace 2008-10-08 11:16:45 -07:00
protocol.c
raw.c netns: add net parameter to IP6_INC_STATS 2008-10-08 10:54:51 -07:00
reassembly.c ipv6: added net argument to IP6_ADD_STATS_BH 2008-10-08 11:13:31 -07:00
route.c netns: add net parameter to IP6_INC_STATS 2008-10-08 10:54:51 -07:00
sit.c
syncookies.c ipv6: syncookies: free reqsk on xfrm_lookup error 2008-08-03 18:13:44 -07:00
sysctl_net_ipv6.c ipv6: sysctl fixes 2008-08-25 15:18:15 -07:00
tcp_ipv6.c tcpv6: convert opt[] -> topt in tcp_v6_send_reset 2008-10-09 14:42:01 -07:00
tunnel6.c
udp_impl.h net: change proto destroy method to return void 2008-06-14 17:04:49 -07:00
udp.c inet: Don't lookup the socket if there's a socket attached to the skb 2008-10-07 12:41:01 -07:00
udplite.c netns: make uplitev6 mib per/namespace 2008-10-07 14:50:06 -07:00
xfrm6_input.c
xfrm6_mode_beet.c ipsec: Interfamily IPSec BEET, ipv4-inner ipv6-outer 2008-08-06 02:40:25 -07:00
xfrm6_mode_ro.c
xfrm6_mode_transport.c
xfrm6_mode_tunnel.c [IPSEC]: Fix inter address family IPsec tunnel handling. 2008-03-24 14:51:51 -07:00
xfrm6_output.c
xfrm6_policy.c netns: Add network namespace argument to rt6_fill_node() and ipv6_dev_get_saddr() 2008-08-14 15:33:21 -07:00
xfrm6_state.c
xfrm6_tunnel.c