proto.c 30.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/*
 *  net/dccp/proto.c
 *
 *  An implementation of the DCCP protocol
 *  Arnaldo Carvalho de Melo <acme@conectiva.com.br>
 *
 *	This program is free software; you can redistribute it and/or modify it
 *	under the terms of the GNU General Public License version 2 as
 *	published by the Free Software Foundation.
 */

#include <linux/dccp.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/in.h>
#include <linux/if_arp.h>
#include <linux/init.h>
#include <linux/random.h>
23
#include <linux/slab.h>
24 25
#include <net/checksum.h>

26
#include <net/inet_sock.h>
27
#include <net/inet_common.h>
28 29 30
#include <net/sock.h>
#include <net/xfrm.h>

31
#include <asm/ioctls.h>
32 33 34 35 36 37 38
#include <linux/spinlock.h>
#include <linux/timer.h>
#include <linux/delay.h>
#include <linux/poll.h>

#include "ccid.h"
#include "dccp.h"
39
#include "feat.h"
40

41
DEFINE_SNMP_STAT(struct dccp_mib, dccp_statistics) __read_mostly;
42

43 44
EXPORT_SYMBOL_GPL(dccp_statistics);

45
struct percpu_counter dccp_orphan_count;
46 47
EXPORT_SYMBOL_GPL(dccp_orphan_count);

48
struct inet_hashinfo dccp_hashinfo;
49 50
EXPORT_SYMBOL_GPL(dccp_hashinfo);

51 52 53
/* the maximum queue length for tx in packets. 0 is no limit */
int sysctl_dccp_tx_qlen __read_mostly = 5;

54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
#ifdef CONFIG_IP_DCCP_DEBUG
static const char *dccp_state_name(const int state)
{
	static const char *const dccp_state_names[] = {
	[DCCP_OPEN]		= "OPEN",
	[DCCP_REQUESTING]	= "REQUESTING",
	[DCCP_PARTOPEN]		= "PARTOPEN",
	[DCCP_LISTEN]		= "LISTEN",
	[DCCP_RESPOND]		= "RESPOND",
	[DCCP_CLOSING]		= "CLOSING",
	[DCCP_ACTIVE_CLOSEREQ]	= "CLOSEREQ",
	[DCCP_PASSIVE_CLOSE]	= "PASSIVE_CLOSE",
	[DCCP_PASSIVE_CLOSEREQ]	= "PASSIVE_CLOSEREQ",
	[DCCP_TIME_WAIT]	= "TIME_WAIT",
	[DCCP_CLOSED]		= "CLOSED",
	};

	if (state >= DCCP_MAX_STATES)
		return "INVALID STATE!";
	else
		return dccp_state_names[state];
}
#endif

78 79 80 81
void dccp_set_state(struct sock *sk, const int state)
{
	const int oldstate = sk->sk_state;

82
	dccp_pr_debug("%s(%p)  %s  -->  %s\n", dccp_role(sk), sk,
83 84 85 86 87 88 89
		      dccp_state_name(oldstate), dccp_state_name(state));
	WARN_ON(state == oldstate);

	switch (state) {
	case DCCP_OPEN:
		if (oldstate != DCCP_OPEN)
			DCCP_INC_STATS(DCCP_MIB_CURRESTAB);
90 91 92
		/* Client retransmits all Confirm options until entering OPEN */
		if (oldstate == DCCP_PARTOPEN)
			dccp_feat_list_purge(&dccp_sk(sk)->dccps_featneg);
93 94 95
		break;

	case DCCP_CLOSED:
96 97
		if (oldstate == DCCP_OPEN || oldstate == DCCP_ACTIVE_CLOSEREQ ||
		    oldstate == DCCP_CLOSING)
98 99 100 101 102
			DCCP_INC_STATS(DCCP_MIB_ESTABRESETS);

		sk->sk_prot->unhash(sk);
		if (inet_csk(sk)->icsk_bind_hash != NULL &&
		    !(sk->sk_userlocks & SOCK_BINDPORT_LOCK))
103
			inet_put_port(sk);
104 105 106 107 108 109 110 111 112 113 114 115 116 117
		/* fall through */
	default:
		if (oldstate == DCCP_OPEN)
			DCCP_DEC_STATS(DCCP_MIB_CURRESTAB);
	}

	/* Change state AFTER socket is unhashed to avoid closed
	 * socket sitting in hash tables.
	 */
	sk->sk_state = state;
}

EXPORT_SYMBOL_GPL(dccp_set_state);

118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
static void dccp_finish_passive_close(struct sock *sk)
{
	switch (sk->sk_state) {
	case DCCP_PASSIVE_CLOSE:
		/* Node (client or server) has received Close packet. */
		dccp_send_reset(sk, DCCP_RESET_CODE_CLOSED);
		dccp_set_state(sk, DCCP_CLOSED);
		break;
	case DCCP_PASSIVE_CLOSEREQ:
		/*
		 * Client received CloseReq. We set the `active' flag so that
		 * dccp_send_close() retransmits the Close as per RFC 4340, 8.3.
		 */
		dccp_send_close(sk, 1);
		dccp_set_state(sk, DCCP_CLOSING);
	}
}

136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
void dccp_done(struct sock *sk)
{
	dccp_set_state(sk, DCCP_CLOSED);
	dccp_clear_xmit_timers(sk);

	sk->sk_shutdown = SHUTDOWN_MASK;

	if (!sock_flag(sk, SOCK_DEAD))
		sk->sk_state_change(sk);
	else
		inet_csk_destroy_sock(sk);
}

EXPORT_SYMBOL_GPL(dccp_done);

151 152
const char *dccp_packet_name(const int type)
{
153
	static const char *const dccp_packet_names[] = {
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
		[DCCP_PKT_REQUEST]  = "REQUEST",
		[DCCP_PKT_RESPONSE] = "RESPONSE",
		[DCCP_PKT_DATA]	    = "DATA",
		[DCCP_PKT_ACK]	    = "ACK",
		[DCCP_PKT_DATAACK]  = "DATAACK",
		[DCCP_PKT_CLOSEREQ] = "CLOSEREQ",
		[DCCP_PKT_CLOSE]    = "CLOSE",
		[DCCP_PKT_RESET]    = "RESET",
		[DCCP_PKT_SYNC]	    = "SYNC",
		[DCCP_PKT_SYNCACK]  = "SYNCACK",
	};

	if (type >= DCCP_NR_PKT_TYPES)
		return "INVALID";
	else
		return dccp_packet_names[type];
}

EXPORT_SYMBOL_GPL(dccp_packet_name);

174 175 176 177 178 179 180 181 182
static void dccp_sk_destruct(struct sock *sk)
{
	struct dccp_sock *dp = dccp_sk(sk);

	ccid_hc_tx_delete(dp->dccps_hc_tx_ccid, sk);
	dp->dccps_hc_tx_ccid = NULL;
	inet_sock_destruct(sk);
}

183
int dccp_init_sock(struct sock *sk, const __u8 ctl_sock_initialized)
184 185 186 187
{
	struct dccp_sock *dp = dccp_sk(sk);
	struct inet_connection_sock *icsk = inet_csk(sk);

188 189 190 191
	icsk->icsk_rto		= DCCP_TIMEOUT_INIT;
	icsk->icsk_syn_retries	= sysctl_dccp_request_retries;
	sk->sk_state		= DCCP_CLOSED;
	sk->sk_write_space	= dccp_write_space;
192
	sk->sk_destruct		= dccp_sk_destruct;
193
	icsk->icsk_sync_mss	= dccp_sync_mss;
194
	dp->dccps_mss_cache	= 536;
195 196 197
	dp->dccps_rate_last	= jiffies;
	dp->dccps_role		= DCCP_ROLE_UNDEFINED;
	dp->dccps_service	= DCCP_SERVICE_CODE_IS_ABSENT;
198
	dp->dccps_tx_qlen	= sysctl_dccp_tx_qlen;
199 200 201

	dccp_init_xmit_timers(sk);

202
	INIT_LIST_HEAD(&dp->dccps_featneg);
203 204 205
	/* control socket doesn't need feat nego */
	if (likely(ctl_sock_initialized))
		return dccp_feat_init(sk);
206 207 208 209 210
	return 0;
}

EXPORT_SYMBOL_GPL(dccp_init_sock);

211
void dccp_destroy_sock(struct sock *sk)
212 213 214
{
	struct dccp_sock *dp = dccp_sk(sk);

215
	__skb_queue_purge(&sk->sk_write_queue);
216 217 218 219 220 221 222
	if (sk->sk_send_head != NULL) {
		kfree_skb(sk->sk_send_head);
		sk->sk_send_head = NULL;
	}

	/* Clean up a referenced DCCP bind bucket. */
	if (inet_csk(sk)->icsk_bind_hash != NULL)
223
		inet_put_port(sk);
224 225 226 227

	kfree(dp->dccps_service_list);
	dp->dccps_service_list = NULL;

228
	if (dp->dccps_hc_rx_ackvec != NULL) {
229 230 231 232
		dccp_ackvec_free(dp->dccps_hc_rx_ackvec);
		dp->dccps_hc_rx_ackvec = NULL;
	}
	ccid_hc_rx_delete(dp->dccps_hc_rx_ccid, sk);
233
	dp->dccps_hc_rx_ccid = NULL;
234 235

	/* clean up feature negotiation state */
236
	dccp_feat_list_purge(&dp->dccps_featneg);
237 238 239 240
}

EXPORT_SYMBOL_GPL(dccp_destroy_sock);

241
static inline int dccp_listen_start(struct sock *sk, int backlog)
242
{
243 244 245
	struct dccp_sock *dp = dccp_sk(sk);

	dp->dccps_role = DCCP_ROLE_LISTEN;
246 247 248
	/* do not start to listen if feature negotiation setup fails */
	if (dccp_feat_finalise_settings(dp))
		return -EPROTO;
249
	return inet_csk_listen_start(sk, backlog);
250 251
}

252 253 254 255 256 257
static inline int dccp_need_reset(int state)
{
	return state != DCCP_CLOSED && state != DCCP_LISTEN &&
	       state != DCCP_REQUESTING;
}

258 259 260 261
int dccp_disconnect(struct sock *sk, int flags)
{
	struct inet_connection_sock *icsk = inet_csk(sk);
	struct inet_sock *inet = inet_sk(sk);
262
	struct dccp_sock *dp = dccp_sk(sk);
263 264 265 266 267 268
	int err = 0;
	const int old_state = sk->sk_state;

	if (old_state != DCCP_CLOSED)
		dccp_set_state(sk, DCCP_CLOSED);

269 270 271 272
	/*
	 * This corresponds to the ABORT function of RFC793, sec. 3.8
	 * TCP uses a RST segment, DCCP a Reset packet with Code 2, "Aborted".
	 */
273 274
	if (old_state == DCCP_LISTEN) {
		inet_csk_listen_stop(sk);
275 276 277
	} else if (dccp_need_reset(old_state)) {
		dccp_send_reset(sk, DCCP_RESET_CODE_ABORTED);
		sk->sk_err = ECONNRESET;
278 279 280 281
	} else if (old_state == DCCP_REQUESTING)
		sk->sk_err = ECONNRESET;

	dccp_clear_xmit_timers(sk);
282 283 284 285
	ccid_hc_rx_delete(dp->dccps_hc_rx_ccid, sk);
	ccid_hc_tx_delete(dp->dccps_hc_tx_ccid, sk);
	dp->dccps_hc_rx_ccid = NULL;
	dp->dccps_hc_tx_ccid = NULL;
286

287
	__skb_queue_purge(&sk->sk_receive_queue);
288
	__skb_queue_purge(&sk->sk_write_queue);
289 290 291 292 293
	if (sk->sk_send_head != NULL) {
		__kfree_skb(sk->sk_send_head);
		sk->sk_send_head = NULL;
	}

E
Eric Dumazet 已提交
294
	inet->inet_dport = 0;
295 296 297 298 299 300 301 302 303 304 305

	if (!(sk->sk_userlocks & SOCK_BINDADDR_LOCK))
		inet_reset_saddr(sk);

	sk->sk_shutdown = 0;
	sock_reset_flag(sk, SOCK_DONE);

	icsk->icsk_backoff = 0;
	inet_csk_delack_init(sk);
	__sk_dst_reset(sk);

E
Eric Dumazet 已提交
306
	WARN_ON(inet->inet_num && !icsk->icsk_bind_hash);
307 308 309 310 311

	sk->sk_error_report(sk);
	return err;
}

312 313
EXPORT_SYMBOL_GPL(dccp_disconnect);

314 315 316 317 318 319 320
/*
 *	Wait for a DCCP event.
 *
 *	Note that we don't need to lock the socket, as the upper poll layers
 *	take care of normal races (between the test and the event) and we don't
 *	go look at any of the socket buffers directly.
 */
321 322
unsigned int dccp_poll(struct file *file, struct socket *sock,
		       poll_table *wait)
323 324 325 326
{
	unsigned int mask;
	struct sock *sk = sock->sk;

E
Eric Dumazet 已提交
327
	sock_poll_wait(file, sk_sleep(sk), wait);
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342
	if (sk->sk_state == DCCP_LISTEN)
		return inet_csk_listen_poll(sk);

	/* Socket is not locked. We are protected from async events
	   by poll logic and correct handling of state changes
	   made by another threads is impossible in any case.
	 */

	mask = 0;
	if (sk->sk_err)
		mask = POLLERR;

	if (sk->sk_shutdown == SHUTDOWN_MASK || sk->sk_state == DCCP_CLOSED)
		mask |= POLLHUP;
	if (sk->sk_shutdown & RCV_SHUTDOWN)
343
		mask |= POLLIN | POLLRDNORM | POLLRDHUP;
344 345 346 347 348 349 350

	/* Connected? */
	if ((1 << sk->sk_state) & ~(DCCPF_REQUESTING | DCCPF_RESPOND)) {
		if (atomic_read(&sk->sk_rmem_alloc) > 0)
			mask |= POLLIN | POLLRDNORM;

		if (!(sk->sk_shutdown & SEND_SHUTDOWN)) {
351
			if (sk_stream_is_writeable(sk)) {
352 353
				mask |= POLLOUT | POLLWRNORM;
			} else {  /* send SIGIO later */
354
				sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk);
355 356 357 358 359 360
				set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);

				/* Race breaker. If space is freed after
				 * wspace test but before the flags are set,
				 * IO signal will be lost.
				 */
361
				if (sk_stream_is_writeable(sk))
362 363 364 365 366 367 368
					mask |= POLLOUT | POLLWRNORM;
			}
		}
	}
	return mask;
}

369 370
EXPORT_SYMBOL_GPL(dccp_poll);

371 372
int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg)
{
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402
	int rc = -ENOTCONN;

	lock_sock(sk);

	if (sk->sk_state == DCCP_LISTEN)
		goto out;

	switch (cmd) {
	case SIOCINQ: {
		struct sk_buff *skb;
		unsigned long amount = 0;

		skb = skb_peek(&sk->sk_receive_queue);
		if (skb != NULL) {
			/*
			 * We will only return the amount of this packet since
			 * that is all that will be read.
			 */
			amount = skb->len;
		}
		rc = put_user(amount, (int __user *)arg);
	}
		break;
	default:
		rc = -ENOIOCTLCMD;
		break;
	}
out:
	release_sock(sk);
	return rc;
403 404
}

405 406
EXPORT_SYMBOL_GPL(dccp_ioctl);

407
static int dccp_setsockopt_service(struct sock *sk, const __be32 service,
408
				   char __user *optval, unsigned int optlen)
409 410 411 412
{
	struct dccp_sock *dp = dccp_sk(sk);
	struct dccp_service_list *sl = NULL;

413
	if (service == DCCP_SERVICE_INVALID_VALUE ||
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434
	    optlen > DCCP_SERVICE_LIST_MAX_LEN * sizeof(u32))
		return -EINVAL;

	if (optlen > sizeof(service)) {
		sl = kmalloc(optlen, GFP_KERNEL);
		if (sl == NULL)
			return -ENOMEM;

		sl->dccpsl_nr = optlen / sizeof(u32) - 1;
		if (copy_from_user(sl->dccpsl_list,
				   optval + sizeof(service),
				   optlen - sizeof(service)) ||
		    dccp_list_has_service(sl, DCCP_SERVICE_INVALID_VALUE)) {
			kfree(sl);
			return -EFAULT;
		}
	}

	lock_sock(sk);
	dp->dccps_service = service;

J
Jesper Juhl 已提交
435
	kfree(dp->dccps_service_list);
436 437 438 439 440 441

	dp->dccps_service_list = sl;
	release_sock(sk);
	return 0;
}

442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477
static int dccp_setsockopt_cscov(struct sock *sk, int cscov, bool rx)
{
	u8 *list, len;
	int i, rc;

	if (cscov < 0 || cscov > 15)
		return -EINVAL;
	/*
	 * Populate a list of permissible values, in the range cscov...15. This
	 * is necessary since feature negotiation of single values only works if
	 * both sides incidentally choose the same value. Since the list starts
	 * lowest-value first, negotiation will pick the smallest shared value.
	 */
	if (cscov == 0)
		return 0;
	len = 16 - cscov;

	list = kmalloc(len, GFP_KERNEL);
	if (list == NULL)
		return -ENOBUFS;

	for (i = 0; i < len; i++)
		list[i] = cscov++;

	rc = dccp_feat_register_sp(sk, DCCPF_MIN_CSUM_COVER, rx, list, len);

	if (rc == 0) {
		if (rx)
			dccp_sk(sk)->dccps_pcrlen = cscov;
		else
			dccp_sk(sk)->dccps_pcslen = cscov;
	}
	kfree(list);
	return rc;
}

478
static int dccp_setsockopt_ccid(struct sock *sk, int type,
479
				char __user *optval, unsigned int optlen)
480 481 482 483 484 485 486
{
	u8 *val;
	int rc = 0;

	if (optlen < 1 || optlen > DCCP_FEAT_MAX_SP_VALS)
		return -EINVAL;

J
Julia Lawall 已提交
487 488 489
	val = memdup_user(optval, optlen);
	if (IS_ERR(val))
		return PTR_ERR(val);
490 491 492 493 494 495 496 497 498 499 500 501 502

	lock_sock(sk);
	if (type == DCCP_SOCKOPT_TX_CCID || type == DCCP_SOCKOPT_CCID)
		rc = dccp_feat_register_sp(sk, DCCPF_CCID, 1, val, optlen);

	if (!rc && (type == DCCP_SOCKOPT_RX_CCID || type == DCCP_SOCKOPT_CCID))
		rc = dccp_feat_register_sp(sk, DCCPF_CCID, 0, val, optlen);
	release_sock(sk);

	kfree(val);
	return rc;
}

503
static int do_dccp_setsockopt(struct sock *sk, int level, int optname,
504
		char __user *optval, unsigned int optlen)
505
{
506 507
	struct dccp_sock *dp = dccp_sk(sk);
	int val, err = 0;
508

G
Gerrit Renker 已提交
509 510 511 512 513 514 515 516
	switch (optname) {
	case DCCP_SOCKOPT_PACKET_SIZE:
		DCCP_WARN("sockopt(PACKET_SIZE) is deprecated: fix your app\n");
		return 0;
	case DCCP_SOCKOPT_CHANGE_L:
	case DCCP_SOCKOPT_CHANGE_R:
		DCCP_WARN("sockopt(CHANGE_L/R) is deprecated: fix your app\n");
		return 0;
517 518 519 520
	case DCCP_SOCKOPT_CCID:
	case DCCP_SOCKOPT_RX_CCID:
	case DCCP_SOCKOPT_TX_CCID:
		return dccp_setsockopt_ccid(sk, optname, optval, optlen);
G
Gerrit Renker 已提交
521 522 523
	}

	if (optlen < (int)sizeof(int))
524 525 526 527 528
		return -EINVAL;

	if (get_user(val, (int __user *)optval))
		return -EFAULT;

529 530
	if (optname == DCCP_SOCKOPT_SERVICE)
		return dccp_setsockopt_service(sk, val, optval, optlen);
531

532
	lock_sock(sk);
533
	switch (optname) {
534 535 536 537 538 539
	case DCCP_SOCKOPT_SERVER_TIMEWAIT:
		if (dp->dccps_role != DCCP_ROLE_SERVER)
			err = -EOPNOTSUPP;
		else
			dp->dccps_server_timewait = (val != 0);
		break;
540 541
	case DCCP_SOCKOPT_SEND_CSCOV:
		err = dccp_setsockopt_cscov(sk, val, false);
542
		break;
543 544
	case DCCP_SOCKOPT_RECV_CSCOV:
		err = dccp_setsockopt_cscov(sk, val, true);
545
		break;
546 547 548 549 550 551 552 553 554 555 556 557 558 559
	case DCCP_SOCKOPT_QPOLICY_ID:
		if (sk->sk_state != DCCP_CLOSED)
			err = -EISCONN;
		else if (val < 0 || val >= DCCPQ_POLICY_MAX)
			err = -EINVAL;
		else
			dp->dccps_qpolicy = val;
		break;
	case DCCP_SOCKOPT_QPOLICY_TXQLEN:
		if (val < 0)
			err = -EINVAL;
		else
			dp->dccps_tx_qlen = val;
		break;
560 561 562 563
	default:
		err = -ENOPROTOOPT;
		break;
	}
564
	release_sock(sk);
G
Gerrit Renker 已提交
565

566
	return err;
567 568
}

569
int dccp_setsockopt(struct sock *sk, int level, int optname,
570
		    char __user *optval, unsigned int optlen)
571 572 573 574 575 576 577
{
	if (level != SOL_DCCP)
		return inet_csk(sk)->icsk_af_ops->setsockopt(sk, level,
							     optname, optval,
							     optlen);
	return do_dccp_setsockopt(sk, level, optname, optval, optlen);
}
578

579 580
EXPORT_SYMBOL_GPL(dccp_setsockopt);

581 582
#ifdef CONFIG_COMPAT
int compat_dccp_setsockopt(struct sock *sk, int level, int optname,
583
			   char __user *optval, unsigned int optlen)
584
{
585 586 587
	if (level != SOL_DCCP)
		return inet_csk_compat_setsockopt(sk, level, optname,
						  optval, optlen);
588 589
	return do_dccp_setsockopt(sk, level, optname, optval, optlen);
}
590

591 592 593
EXPORT_SYMBOL_GPL(compat_dccp_setsockopt);
#endif

594
static int dccp_getsockopt_service(struct sock *sk, int len,
595
				   __be32 __user *optval,
596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621
				   int __user *optlen)
{
	const struct dccp_sock *dp = dccp_sk(sk);
	const struct dccp_service_list *sl;
	int err = -ENOENT, slen = 0, total_len = sizeof(u32);

	lock_sock(sk);
	if ((sl = dp->dccps_service_list) != NULL) {
		slen = sl->dccpsl_nr * sizeof(u32);
		total_len += slen;
	}

	err = -EINVAL;
	if (total_len > len)
		goto out;

	err = 0;
	if (put_user(total_len, optlen) ||
	    put_user(dp->dccps_service, optval) ||
	    (sl != NULL && copy_to_user(optval + 1, sl->dccpsl_list, slen)))
		err = -EFAULT;
out:
	release_sock(sk);
	return err;
}

622
static int do_dccp_getsockopt(struct sock *sk, int level, int optname,
623
		    char __user *optval, int __user *optlen)
624
{
625 626
	struct dccp_sock *dp;
	int val, len;
627

628 629 630
	if (get_user(len, optlen))
		return -EFAULT;

631
	if (len < (int)sizeof(int))
632 633 634 635 636 637
		return -EINVAL;

	dp = dccp_sk(sk);

	switch (optname) {
	case DCCP_SOCKOPT_PACKET_SIZE:
G
Gerrit Renker 已提交
638
		DCCP_WARN("sockopt(PACKET_SIZE) is deprecated: fix your app\n");
639
		return 0;
640 641
	case DCCP_SOCKOPT_SERVICE:
		return dccp_getsockopt_service(sk, len,
642
					       (__be32 __user *)optval, optlen);
643 644 645
	case DCCP_SOCKOPT_GET_CUR_MPS:
		val = dp->dccps_mss_cache;
		break;
G
Gerrit Renker 已提交
646 647
	case DCCP_SOCKOPT_AVAILABLE_CCIDS:
		return ccid_getsockopt_builtin_ccids(sk, len, optval, optlen);
648 649 650 651 652 653 654 655 656 657
	case DCCP_SOCKOPT_TX_CCID:
		val = ccid_get_current_tx_ccid(dp);
		if (val < 0)
			return -ENOPROTOOPT;
		break;
	case DCCP_SOCKOPT_RX_CCID:
		val = ccid_get_current_rx_ccid(dp);
		if (val < 0)
			return -ENOPROTOOPT;
		break;
658 659 660
	case DCCP_SOCKOPT_SERVER_TIMEWAIT:
		val = dp->dccps_server_timewait;
		break;
661 662 663 664 665 666
	case DCCP_SOCKOPT_SEND_CSCOV:
		val = dp->dccps_pcslen;
		break;
	case DCCP_SOCKOPT_RECV_CSCOV:
		val = dp->dccps_pcrlen;
		break;
667 668 669 670 671 672
	case DCCP_SOCKOPT_QPOLICY_ID:
		val = dp->dccps_qpolicy;
		break;
	case DCCP_SOCKOPT_QPOLICY_TXQLEN:
		val = dp->dccps_tx_qlen;
		break;
673 674 675 676 677 678
	case 128 ... 191:
		return ccid_hc_rx_getsockopt(dp->dccps_hc_rx_ccid, sk, optname,
					     len, (u32 __user *)optval, optlen);
	case 192 ... 255:
		return ccid_hc_tx_getsockopt(dp->dccps_hc_tx_ccid, sk, optname,
					     len, (u32 __user *)optval, optlen);
679 680 681 682
	default:
		return -ENOPROTOOPT;
	}

683
	len = sizeof(val);
684 685 686 687
	if (put_user(len, optlen) || copy_to_user(optval, &val, len))
		return -EFAULT;

	return 0;
688 689
}

690 691 692 693 694 695 696 697 698
int dccp_getsockopt(struct sock *sk, int level, int optname,
		    char __user *optval, int __user *optlen)
{
	if (level != SOL_DCCP)
		return inet_csk(sk)->icsk_af_ops->getsockopt(sk, level,
							     optname, optval,
							     optlen);
	return do_dccp_getsockopt(sk, level, optname, optval, optlen);
}
699

700 701
EXPORT_SYMBOL_GPL(dccp_getsockopt);

702 703
#ifdef CONFIG_COMPAT
int compat_dccp_getsockopt(struct sock *sk, int level, int optname,
704
			   char __user *optval, int __user *optlen)
705
{
706 707 708
	if (level != SOL_DCCP)
		return inet_csk_compat_getsockopt(sk, level, optname,
						  optval, optlen);
709 710
	return do_dccp_getsockopt(sk, level, optname, optval, optlen);
}
711

712 713 714
EXPORT_SYMBOL_GPL(compat_dccp_getsockopt);
#endif

715 716
static int dccp_msghdr_parse(struct msghdr *msg, struct sk_buff *skb)
{
717
	struct cmsghdr *cmsg;
718 719 720 721 722 723 724 725 726 727 728 729 730

	/*
	 * Assign an (opaque) qpolicy priority value to skb->priority.
	 *
	 * We are overloading this skb field for use with the qpolicy subystem.
	 * The skb->priority is normally used for the SO_PRIORITY option, which
	 * is initialised from sk_priority. Since the assignment of sk_priority
	 * to skb->priority happens later (on layer 3), we overload this field
	 * for use with queueing priorities as long as the skb is on layer 4.
	 * The default priority value (if nothing is set) is 0.
	 */
	skb->priority = 0;

731
	for_each_cmsghdr(cmsg, msg) {
732 733 734 735 736 737
		if (!CMSG_OK(msg, cmsg))
			return -EINVAL;

		if (cmsg->cmsg_level != SOL_DCCP)
			continue;

738 739 740 741
		if (cmsg->cmsg_type <= DCCP_SCM_QPOLICY_MAX &&
		    !dccp_qpolicy_param_ok(skb->sk, cmsg->cmsg_type))
			return -EINVAL;

742 743 744 745 746 747 748 749 750 751 752 753 754
		switch (cmsg->cmsg_type) {
		case DCCP_SCM_PRIORITY:
			if (cmsg->cmsg_len != CMSG_LEN(sizeof(__u32)))
				return -EINVAL;
			skb->priority = *(__u32 *)CMSG_DATA(cmsg);
			break;
		default:
			return -EINVAL;
		}
	}
	return 0;
}

755
int dccp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
756 757 758 759 760 761 762 763 764 765 766 767
{
	const struct dccp_sock *dp = dccp_sk(sk);
	const int flags = msg->msg_flags;
	const int noblock = flags & MSG_DONTWAIT;
	struct sk_buff *skb;
	int rc, size;
	long timeo;

	if (len > dp->dccps_mss_cache)
		return -EMSGSIZE;

	lock_sock(sk);
768

769
	if (dccp_qpolicy_full(sk)) {
770 771 772 773
		rc = -EAGAIN;
		goto out_release;
	}

774
	timeo = sock_sndtimeo(sk, noblock);
775 776 777 778 779 780

	/*
	 * We have to use sk_stream_wait_connect here to set sk_write_pending,
	 * so that the trick in dccp_rcv_request_sent_state_process.
	 */
	/* Wait for a connection to finish. */
781
	if ((1 << sk->sk_state) & ~(DCCPF_OPEN | DCCPF_PARTOPEN))
782
		if ((rc = sk_stream_wait_connect(sk, &timeo)) != 0)
783
			goto out_release;
784 785 786 787 788 789 790 791 792

	size = sk->sk_prot->max_header + len;
	release_sock(sk);
	skb = sock_alloc_send_skb(sk, size, noblock, &rc);
	lock_sock(sk);
	if (skb == NULL)
		goto out_release;

	skb_reserve(skb, sk->sk_prot->max_header);
A
Al Viro 已提交
793
	rc = memcpy_from_msg(skb_put(skb, len), msg, len);
794 795 796
	if (rc != 0)
		goto out_discard;

797 798 799 800 801
	rc = dccp_msghdr_parse(msg, skb);
	if (rc != 0)
		goto out_discard;

	dccp_qpolicy_push(sk, skb);
802 803 804 805 806 807 808
	/*
	 * The xmit_timer is set if the TX CCID is rate-based and will expire
	 * when congestion control permits to release further packets into the
	 * network. Window-based CCIDs do not use this timer.
	 */
	if (!timer_pending(&dp->dccps_xmit_timer))
		dccp_write_xmit(sk);
809 810 811
out_release:
	release_sock(sk);
	return rc ? : len;
812 813
out_discard:
	kfree_skb(skb);
814 815 816
	goto out_release;
}

817 818
EXPORT_SYMBOL_GPL(dccp_sendmsg);

819 820
int dccp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock,
		 int flags, int *addr_len)
821 822 823 824 825 826
{
	const struct dccp_hdr *dh;
	long timeo;

	lock_sock(sk);

827 828
	if (sk->sk_state == DCCP_LISTEN) {
		len = -ENOTCONN;
829 830 831
		goto out;
	}

832
	timeo = sock_rcvtimeo(sk, nonblock);
833 834

	do {
835
		struct sk_buff *skb = skb_peek(&sk->sk_receive_queue);
836

837 838
		if (skb == NULL)
			goto verify_sock_status;
839

840
		dh = dccp_hdr(skb);
841

842 843 844
		switch (dh->dccph_type) {
		case DCCP_PKT_DATA:
		case DCCP_PKT_DATAACK:
845
			goto found_ok_skb;
846

847 848 849 850 851 852 853 854
		case DCCP_PKT_CLOSE:
		case DCCP_PKT_CLOSEREQ:
			if (!(flags & MSG_PEEK))
				dccp_finish_passive_close(sk);
			/* fall through */
		case DCCP_PKT_RESET:
			dccp_pr_debug("found fin (%s) ok!\n",
				      dccp_packet_name(dh->dccph_type));
855 856
			len = 0;
			goto found_fin_ok;
857 858 859
		default:
			dccp_pr_debug("packet_type=%s\n",
				      dccp_packet_name(dh->dccph_type));
D
Dan Williams 已提交
860
			sk_eat_skb(sk, skb);
861 862 863 864
		}
verify_sock_status:
		if (sock_flag(sk, SOCK_DONE)) {
			len = 0;
865
			break;
866
		}
867

868 869 870 871
		if (sk->sk_err) {
			len = sock_error(sk);
			break;
		}
872

873 874 875 876
		if (sk->sk_shutdown & RCV_SHUTDOWN) {
			len = 0;
			break;
		}
877

878 879 880 881 882 883
		if (sk->sk_state == DCCP_CLOSED) {
			if (!sock_flag(sk, SOCK_DONE)) {
				/* This occurs when user tries to read
				 * from never connected socket.
				 */
				len = -ENOTCONN;
884 885
				break;
			}
886 887
			len = 0;
			break;
888 889
		}

890 891 892 893
		if (!timeo) {
			len = -EAGAIN;
			break;
		}
894

895 896 897 898
		if (signal_pending(current)) {
			len = sock_intr_errno(timeo);
			break;
		}
899

900
		sk_wait_data(sk, &timeo, NULL);
901 902
		continue;
	found_ok_skb:
903 904 905 906 907
		if (len > skb->len)
			len = skb->len;
		else if (len < skb->len)
			msg->msg_flags |= MSG_TRUNC;

908
		if (skb_copy_datagram_msg(skb, 0, msg, len)) {
909 910 911
			/* Exception. Bailout! */
			len = -EFAULT;
			break;
912
		}
913 914
		if (flags & MSG_TRUNC)
			len = skb->len;
915 916
	found_fin_ok:
		if (!(flags & MSG_PEEK))
D
Dan Williams 已提交
917
			sk_eat_skb(sk, skb);
918
		break;
919
	} while (1);
920 921
out:
	release_sock(sk);
922
	return len;
923 924
}

925 926 927
EXPORT_SYMBOL_GPL(dccp_recvmsg);

int inet_dccp_listen(struct socket *sock, int backlog)
928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950
{
	struct sock *sk = sock->sk;
	unsigned char old_state;
	int err;

	lock_sock(sk);

	err = -EINVAL;
	if (sock->state != SS_UNCONNECTED || sock->type != SOCK_DCCP)
		goto out;

	old_state = sk->sk_state;
	if (!((1 << old_state) & (DCCPF_CLOSED | DCCPF_LISTEN)))
		goto out;

	/* Really, if the socket is already in listen state
	 * we can only allow the backlog to be adjusted.
	 */
	if (old_state != DCCP_LISTEN) {
		/*
		 * FIXME: here it probably should be sk->sk_prot->listen_start
		 * see tcp_listen_start
		 */
951
		err = dccp_listen_start(sk, backlog);
952 953 954 955 956 957 958 959 960 961 962
		if (err)
			goto out;
	}
	sk->sk_max_ack_backlog = backlog;
	err = 0;

out:
	release_sock(sk);
	return err;
}

963 964
EXPORT_SYMBOL_GPL(inet_dccp_listen);

965
static void dccp_terminate_connection(struct sock *sk)
966
{
967
	u8 next_state = DCCP_CLOSED;
968

969 970 971 972 973 974 975 976 977 978 979
	switch (sk->sk_state) {
	case DCCP_PASSIVE_CLOSE:
	case DCCP_PASSIVE_CLOSEREQ:
		dccp_finish_passive_close(sk);
		break;
	case DCCP_PARTOPEN:
		dccp_pr_debug("Stop PARTOPEN timer (%p)\n", sk);
		inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK);
		/* fall through */
	case DCCP_OPEN:
		dccp_send_close(sk, 1);
980

981 982
		if (dccp_sk(sk)->dccps_role == DCCP_ROLE_SERVER &&
		    !dccp_sk(sk)->dccps_server_timewait)
983 984 985 986 987 988 989
			next_state = DCCP_ACTIVE_CLOSEREQ;
		else
			next_state = DCCP_CLOSING;
		/* fall through */
	default:
		dccp_set_state(sk, next_state);
	}
990 991 992 993
}

void dccp_close(struct sock *sk, long timeout)
{
I
Ian McDonald 已提交
994
	struct dccp_sock *dp = dccp_sk(sk);
995
	struct sk_buff *skb;
996
	u32 data_was_unread = 0;
H
Herbert Xu 已提交
997
	int state;
998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011

	lock_sock(sk);

	sk->sk_shutdown = SHUTDOWN_MASK;

	if (sk->sk_state == DCCP_LISTEN) {
		dccp_set_state(sk, DCCP_CLOSED);

		/* Special case. */
		inet_csk_listen_stop(sk);

		goto adjudge_to_death;
	}

I
Ian McDonald 已提交
1012 1013
	sk_stop_timer(sk, &dp->dccps_xmit_timer);

1014 1015 1016 1017 1018 1019
	/*
	 * We need to flush the recv. buffs.  We do this only on the
	 * descriptor close, not protocol-sourced closes, because the
	  *reader process may not have drained the data yet!
	 */
	while ((skb = __skb_dequeue(&sk->sk_receive_queue)) != NULL) {
1020
		data_was_unread += skb->len;
1021 1022 1023
		__kfree_skb(skb);
	}

1024 1025 1026 1027
	/* If socket has been already reset kill it. */
	if (sk->sk_state == DCCP_CLOSED)
		goto adjudge_to_death;

1028 1029
	if (data_was_unread) {
		/* Unread data was tossed, send an appropriate Reset Code */
G
Gerrit Renker 已提交
1030
		DCCP_WARN("ABORT with %u bytes unread\n", data_was_unread);
1031 1032 1033
		dccp_send_reset(sk, DCCP_RESET_CODE_ABORTED);
		dccp_set_state(sk, DCCP_CLOSED);
	} else if (sock_flag(sk, SOCK_LINGER) && !sk->sk_lingertime) {
1034 1035
		/* Check zero linger _after_ checking for unread data. */
		sk->sk_prot->disconnect(sk, 0);
1036
	} else if (sk->sk_state != DCCP_CLOSED) {
1037 1038 1039 1040 1041
		/*
		 * Normal connection termination. May need to wait if there are
		 * still packets in the TX queue that are delayed by the CCID.
		 */
		dccp_flush_write_queue(sk, &timeout);
1042
		dccp_terminate_connection(sk);
1043 1044
	}

1045 1046 1047 1048 1049 1050 1051 1052
	/*
	 * Flush write queue. This may be necessary in several cases:
	 * - we have been closed by the peer but still have application data;
	 * - abortive termination (unread data or zero linger time),
	 * - normal termination but queue could not be flushed within time limit
	 */
	__skb_queue_purge(&sk->sk_write_queue);

1053 1054 1055
	sk_stream_wait_close(sk, timeout);

adjudge_to_death:
H
Herbert Xu 已提交
1056 1057 1058 1059
	state = sk->sk_state;
	sock_hold(sk);
	sock_orphan(sk);

1060 1061 1062
	/*
	 * It is the last release_sock in its life. It will remove backlog.
	 */
1063 1064 1065 1066 1067 1068 1069
	release_sock(sk);
	/*
	 * Now socket is owned by kernel and we acquire BH lock
	 * to finish close. No need to check for user refs.
	 */
	local_bh_disable();
	bh_lock_sock(sk);
1070
	WARN_ON(sock_owned_by_user(sk));
1071

H
Herbert Xu 已提交
1072 1073
	percpu_counter_inc(sk->sk_prot->orphan_count);

H
Herbert Xu 已提交
1074 1075 1076
	/* Have we already been destroyed by a softirq or backlog? */
	if (state != DCCP_CLOSED && sk->sk_state == DCCP_CLOSED)
		goto out;
1077

1078 1079 1080 1081 1082
	if (sk->sk_state == DCCP_CLOSED)
		inet_csk_destroy_sock(sk);

	/* Otherwise, socket is reprieved until protocol close. */

H
Herbert Xu 已提交
1083
out:
1084 1085 1086 1087 1088
	bh_unlock_sock(sk);
	local_bh_enable();
	sock_put(sk);
}

1089 1090
EXPORT_SYMBOL_GPL(dccp_close);

1091 1092
void dccp_shutdown(struct sock *sk, int how)
{
1093
	dccp_pr_debug("called shutdown(%x)\n", how);
1094 1095
}

1096 1097
EXPORT_SYMBOL_GPL(dccp_shutdown);

1098
static inline int __init dccp_mib_init(void)
1099
{
W
WANG Cong 已提交
1100 1101 1102 1103
	dccp_statistics = alloc_percpu(struct dccp_mib);
	if (!dccp_statistics)
		return -ENOMEM;
	return 0;
1104 1105
}

1106
static inline void dccp_mib_exit(void)
1107
{
W
WANG Cong 已提交
1108
	free_percpu(dccp_statistics);
1109 1110
}

1111 1112 1113 1114
static int thash_entries;
module_param(thash_entries, int, 0444);
MODULE_PARM_DESC(thash_entries, "Number of ehash buckets");

1115
#ifdef CONFIG_IP_DCCP_DEBUG
1116
bool dccp_debug;
1117
module_param(dccp_debug, bool, 0644);
1118
MODULE_PARM_DESC(dccp_debug, "Enable debug messages");
1119 1120

EXPORT_SYMBOL_GPL(dccp_debug);
1121
#endif
1122 1123 1124 1125 1126

static int __init dccp_init(void)
{
	unsigned long goal;
	int ehash_order, bhash_order, i;
1127
	int rc;
1128

1129 1130
	BUILD_BUG_ON(sizeof(struct dccp_skb_cb) >
		     FIELD_SIZEOF(struct sk_buff, cb));
1131
	rc = percpu_counter_init(&dccp_orphan_count, 0, GFP_KERNEL);
1132
	if (rc)
1133
		goto out_fail;
1134
	rc = -ENOBUFS;
1135
	inet_hashinfo_init(&dccp_hashinfo);
1136 1137 1138
	dccp_hashinfo.bind_bucket_cachep =
		kmem_cache_create("dccp_bind_bucket",
				  sizeof(struct inet_bind_bucket), 0,
1139
				  SLAB_HWCACHE_ALIGN, NULL);
1140
	if (!dccp_hashinfo.bind_bucket_cachep)
1141
		goto out_free_percpu;
1142 1143 1144 1145 1146 1147 1148

	/*
	 * Size and allocate the main established and bind bucket
	 * hash tables.
	 *
	 * The methodology is similar to that of the buffer cache.
	 */
1149 1150
	if (totalram_pages >= (128 * 1024))
		goal = totalram_pages >> (21 - PAGE_SHIFT);
1151
	else
1152
		goal = totalram_pages >> (23 - PAGE_SHIFT);
1153 1154

	if (thash_entries)
1155 1156
		goal = (thash_entries *
			sizeof(struct inet_ehash_bucket)) >> PAGE_SHIFT;
1157 1158 1159
	for (ehash_order = 0; (1UL << ehash_order) < goal; ehash_order++)
		;
	do {
1160
		unsigned long hash_size = (1UL << ehash_order) * PAGE_SIZE /
1161
					sizeof(struct inet_ehash_bucket);
1162 1163 1164 1165

		while (hash_size & (hash_size - 1))
			hash_size--;
		dccp_hashinfo.ehash_mask = hash_size - 1;
1166
		dccp_hashinfo.ehash = (struct inet_ehash_bucket *)
1167
			__get_free_pages(GFP_ATOMIC|__GFP_NOWARN, ehash_order);
1168 1169 1170
	} while (!dccp_hashinfo.ehash && --ehash_order > 0);

	if (!dccp_hashinfo.ehash) {
1171
		DCCP_CRIT("Failed to allocate DCCP established hash table");
1172 1173 1174
		goto out_free_bind_bucket_cachep;
	}

E
Eric Dumazet 已提交
1175
	for (i = 0; i <= dccp_hashinfo.ehash_mask; i++)
1176
		INIT_HLIST_NULLS_HEAD(&dccp_hashinfo.ehash[i].chain, i);
1177

1178 1179 1180
	if (inet_ehash_locks_alloc(&dccp_hashinfo))
			goto out_free_dccp_ehash;

1181 1182 1183 1184 1185
	bhash_order = ehash_order;

	do {
		dccp_hashinfo.bhash_size = (1UL << bhash_order) * PAGE_SIZE /
					sizeof(struct inet_bind_hashbucket);
1186 1187
		if ((dccp_hashinfo.bhash_size > (64 * 1024)) &&
		    bhash_order > 0)
1188 1189
			continue;
		dccp_hashinfo.bhash = (struct inet_bind_hashbucket *)
1190
			__get_free_pages(GFP_ATOMIC|__GFP_NOWARN, bhash_order);
1191 1192 1193
	} while (!dccp_hashinfo.bhash && --bhash_order >= 0);

	if (!dccp_hashinfo.bhash) {
1194
		DCCP_CRIT("Failed to allocate DCCP bind hash table");
1195
		goto out_free_dccp_locks;
1196 1197 1198 1199 1200 1201 1202
	}

	for (i = 0; i < dccp_hashinfo.bhash_size; i++) {
		spin_lock_init(&dccp_hashinfo.bhash[i].lock);
		INIT_HLIST_HEAD(&dccp_hashinfo.bhash[i].chain);
	}

1203
	rc = dccp_mib_init();
1204
	if (rc)
1205 1206
		goto out_free_dccp_bhash;

1207
	rc = dccp_ackvec_init();
1208
	if (rc)
1209
		goto out_free_dccp_mib;
1210

1211
	rc = dccp_sysctl_init();
1212 1213
	if (rc)
		goto out_ackvec_exit;
1214

1215 1216 1217 1218
	rc = ccid_initialize_builtins();
	if (rc)
		goto out_sysctl_exit;

1219
	dccp_timestamping_init();
1220 1221 1222

	return 0;

1223 1224
out_sysctl_exit:
	dccp_sysctl_exit();
1225 1226
out_ackvec_exit:
	dccp_ackvec_exit();
1227
out_free_dccp_mib:
1228
	dccp_mib_exit();
1229 1230
out_free_dccp_bhash:
	free_pages((unsigned long)dccp_hashinfo.bhash, bhash_order);
1231 1232
out_free_dccp_locks:
	inet_ehash_locks_free(&dccp_hashinfo);
1233 1234 1235 1236
out_free_dccp_ehash:
	free_pages((unsigned long)dccp_hashinfo.ehash, ehash_order);
out_free_bind_bucket_cachep:
	kmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep);
1237 1238
out_free_percpu:
	percpu_counter_destroy(&dccp_orphan_count);
1239 1240 1241 1242 1243
out_fail:
	dccp_hashinfo.bhash = NULL;
	dccp_hashinfo.ehash = NULL;
	dccp_hashinfo.bind_bucket_cachep = NULL;
	return rc;
1244 1245 1246 1247
}

static void __exit dccp_fini(void)
{
1248
	ccid_cleanup_builtins();
1249
	dccp_mib_exit();
1250 1251 1252 1253
	free_pages((unsigned long)dccp_hashinfo.bhash,
		   get_order(dccp_hashinfo.bhash_size *
			     sizeof(struct inet_bind_hashbucket)));
	free_pages((unsigned long)dccp_hashinfo.ehash,
1254
		   get_order((dccp_hashinfo.ehash_mask + 1) *
1255
			     sizeof(struct inet_ehash_bucket)));
1256
	inet_ehash_locks_free(&dccp_hashinfo);
1257
	kmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep);
1258
	dccp_ackvec_exit();
1259
	dccp_sysctl_exit();
1260
	percpu_counter_destroy(&dccp_orphan_count);
1261 1262 1263 1264 1265 1266 1267 1268
}

module_init(dccp_init);
module_exit(dccp_fini);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Arnaldo Carvalho de Melo <acme@conectiva.com.br>");
MODULE_DESCRIPTION("DCCP - Datagram Congestion Controlled Protocol");