diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2005-12-14 02:16:16 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-01-03 16:10:40 -0500 |
commit | 57cca05af1e20fdc65b55be52c042c234f86c866 (patch) | |
tree | 43b18dca01340861e7ad392c0c2ce398a1c878fd /net/dccp/ipv4.c | |
parent | af05dc9394feb193d221bc9d4c6db768facb4b40 (diff) |
[DCCP]: Introduce dccp_ipv4_af_ops
And make the core DCCP code AF agnostic, just like TCP, now its time
to work on net/dccp/ipv6.c, we are close to the end!
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/ipv4.c')
-rw-r--r-- | net/dccp/ipv4.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 1ac3e30ae791..0ce7d0fe5ee7 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -607,6 +607,15 @@ out: | |||
607 | sock_put(sk); | 607 | sock_put(sk); |
608 | } | 608 | } |
609 | 609 | ||
610 | /* This routine computes an IPv4 DCCP checksum. */ | ||
611 | static void dccp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb) | ||
612 | { | ||
613 | const struct inet_sock *inet = inet_sk(sk); | ||
614 | struct dccp_hdr *dh = dccp_hdr(skb); | ||
615 | |||
616 | dh->dccph_checksum = dccp_v4_checksum(skb, inet->saddr, inet->daddr); | ||
617 | } | ||
618 | |||
610 | int dccp_v4_send_reset(struct sock *sk, enum dccp_reset_codes code) | 619 | int dccp_v4_send_reset(struct sock *sk, enum dccp_reset_codes code) |
611 | { | 620 | { |
612 | struct sk_buff *skb; | 621 | struct sk_buff *skb; |
@@ -1195,6 +1204,19 @@ do_time_wait: | |||
1195 | goto no_dccp_socket; | 1204 | goto no_dccp_socket; |
1196 | } | 1205 | } |
1197 | 1206 | ||
1207 | struct inet_connection_sock_af_ops dccp_ipv4_af_ops = { | ||
1208 | .queue_xmit = ip_queue_xmit, | ||
1209 | .send_check = dccp_v4_send_check, | ||
1210 | .rebuild_header = inet_sk_rebuild_header, | ||
1211 | .conn_request = dccp_v4_conn_request, | ||
1212 | .syn_recv_sock = dccp_v4_request_recv_sock, | ||
1213 | .net_header_len = sizeof(struct iphdr), | ||
1214 | .setsockopt = ip_setsockopt, | ||
1215 | .getsockopt = ip_getsockopt, | ||
1216 | .addr2sockaddr = inet_csk_addr2sockaddr, | ||
1217 | .sockaddr_len = sizeof(struct sockaddr_in), | ||
1218 | }; | ||
1219 | |||
1198 | static int dccp_v4_init_sock(struct sock *sk) | 1220 | static int dccp_v4_init_sock(struct sock *sk) |
1199 | { | 1221 | { |
1200 | struct dccp_sock *dp = dccp_sk(sk); | 1222 | struct dccp_sock *dp = dccp_sk(sk); |
@@ -1240,6 +1262,7 @@ static int dccp_v4_init_sock(struct sock *sk) | |||
1240 | inet_csk(sk)->icsk_rto = DCCP_TIMEOUT_INIT; | 1262 | inet_csk(sk)->icsk_rto = DCCP_TIMEOUT_INIT; |
1241 | sk->sk_state = DCCP_CLOSED; | 1263 | sk->sk_state = DCCP_CLOSED; |
1242 | sk->sk_write_space = dccp_write_space; | 1264 | sk->sk_write_space = dccp_write_space; |
1265 | inet_csk(sk)->icsk_af_ops = &dccp_ipv4_af_ops; | ||
1243 | dp->dccps_mss_cache = 536; | 1266 | dp->dccps_mss_cache = 536; |
1244 | dp->dccps_role = DCCP_ROLE_UNDEFINED; | 1267 | dp->dccps_role = DCCP_ROLE_UNDEFINED; |
1245 | dp->dccps_service = DCCP_SERVICE_INVALID_VALUE; | 1268 | dp->dccps_service = DCCP_SERVICE_INVALID_VALUE; |