Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Add DCCP protocol support from KAME.



details:   https://anonhg.NetBSD.org/src/rev/a1fac918076f
branches:  trunk
changeset: 806218:a1fac918076f
user:      rjs <rjs%NetBSD.org@localhost>
date:      Tue Feb 10 19:11:52 2015 +0000

description:
Add DCCP protocol support from KAME.

diffstat:

 distrib/sets/lists/comp/mi              |     3 +-
 sys/netinet/Makefile                    |     4 +-
 sys/netinet/dccp.h                      |   210 +
 sys/netinet/dccp_cc_sw.c                |    96 +
 sys/netinet/dccp_cc_sw.h                |   101 +
 sys/netinet/dccp_tcplike.c              |  1062 +++++++++
 sys/netinet/dccp_tcplike.h              |   168 +
 sys/netinet/dccp_tfrc.c                 |  1997 ++++++++++++++++++
 sys/netinet/dccp_tfrc.h                 |   246 ++
 sys/netinet/dccp_tfrc_lookup.h          |  1047 +++++++++
 sys/netinet/dccp_usrreq.c               |  3411 +++++++++++++++++++++++++++++++
 sys/netinet/dccp_var.h                  |   330 ++
 sys/netinet/files.netinet               |    10 +-
 sys/netinet/in.h                        |     3 +-
 sys/netinet/in_proto.c                  |    30 +-
 sys/netinet/portalgo.c                  |     5 +-
 sys/netinet6/dccp6_usrreq.c             |   525 ++++
 sys/netinet6/dccp6_var.h                |    52 +
 sys/netinet6/files.netinet6             |     4 +-
 sys/netinet6/in6_proto.c                |    33 +-
 sys/rump/librump/rumpnet/opt/opt_dccp.h |     1 +
 sys/sys/socket.h                        |     4 +-
 22 files changed, 9329 insertions(+), 13 deletions(-)

diffs (truncated from 9576 to 300 lines):

diff -r 467fe34572cc -r a1fac918076f distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi        Tue Feb 10 17:43:44 2015 +0000
+++ b/distrib/sets/lists/comp/mi        Tue Feb 10 19:11:52 2015 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: mi,v 1.1945 2015/02/05 16:07:15 christos Exp $
+#      $NetBSD: mi,v 1.1946 2015/02/10 19:11:52 rjs Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2636,6 +2636,7 @@
 ./usr/include/netconfig.h                      comp-c-include
 ./usr/include/netdb.h                          comp-c-include
 ./usr/include/netgroup.h                       comp-c-include
+./usr/include/netinet/dccp.h                   comp-c-include
 ./usr/include/netinet/icmp6.h                  comp-c-include
 ./usr/include/netinet/icmp_var.h               comp-c-include
 ./usr/include/netinet/if_arc.h                 comp-obsolete           obsolete
diff -r 467fe34572cc -r a1fac918076f sys/netinet/Makefile
--- a/sys/netinet/Makefile      Tue Feb 10 17:43:44 2015 +0000
+++ b/sys/netinet/Makefile      Tue Feb 10 19:11:52 2015 +0000
@@ -1,8 +1,8 @@
-#      $NetBSD: Makefile,v 1.25 2012/09/15 17:41:59 plunky Exp $
+#      $NetBSD: Makefile,v 1.26 2015/02/10 19:11:52 rjs Exp $
 
 INCSDIR= /usr/include/netinet
 
-INCS=  icmp6.h icmp_var.h if_atm.h if_ether.h if_inarp.h igmp.h \
+INCS=  dccp.h icmp6.h icmp_var.h if_atm.h if_ether.h if_inarp.h igmp.h \
        igmp_var.h in.h in_gif.h in_pcb.h in_pcb_hdr.h \
        in_selsrc.h in_systm.h \
        in_var.h ip.h ip_carp.h ip6.h ip_ecn.h ip_encap.h \
diff -r 467fe34572cc -r a1fac918076f sys/netinet/dccp.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/netinet/dccp.h        Tue Feb 10 19:11:52 2015 +0000
@@ -0,0 +1,210 @@
+/*     $KAME: dccp.h,v 1.10 2005/10/26 18:46:33 nishida Exp $  */
+/* $NetBSD: dccp.h,v 1.1 2015/02/10 19:11:52 rjs Exp $ */
+
+/*
+ * Copyright (c) 2003 Joacim Häggmark, Magnus Erixzon, Nils-Erik Mattsson 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Id: dccp.h,v 1.13 2003/07/31 11:14:41 joahag-9 Exp
+ */
+
+#ifndef _NETINET_DCCP_H_
+#define _NETINET_DCCP_H_
+
+/*
+ * DCCP protocol header
+ * draft-ietf-dccp-spec-01.txt 
+ */
+struct dccphdr {
+       u_short         dh_sport;       /* source port */
+       u_short         dh_dport;       /* destination port */
+
+       u_int8_t        dh_off;         /* Data offset */
+#if BYTE_ORDER == LITTLE_ENDIAN
+       u_int8_t        dh_cscov:4,     /* Checksum Length */
+                               dh_ccval:4;     /* Number of non data packets */
+#else
+       u_int8_t        dh_ccval:4,
+                               dh_cscov:4;
+#endif
+       u_short         dh_sum;         /* Checksum */
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+       u_int32_t       dh_x:1,         /* long/short sequence number */
+                               dh_type:4,
+                               dh_res:3,
+                               dh_seq:24;      /* Sequence number */
+#else
+       u_int32_t       dh_res:3,       /* Reserved */
+                               dh_type:4,      /* Type of message */
+                               dh_x:1,         /* long/short sequence number */
+                               dh_seq:24;      
+#endif
+};
+
+struct dccplhdr {
+       u_short         dh_sport;       /* source port */
+       u_short         dh_dport;       /* destination port */
+
+       u_int8_t        dh_off;         /* Data offset */
+#if BYTE_ORDER == LITTLE_ENDIAN
+       u_int8_t        dh_cscov:4,     /* Checksum Length */
+                               dh_ccval:4;     /* Number of non data packets */
+#else
+       u_int8_t        dh_ccval:4,
+                               dh_cscov:4;
+#endif
+       u_short         dh_sum;         /* Checksum */
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+       u_int8_t        dh_x:1,         /* long/short sequence number */
+                               dh_type:4,
+                               dh_res:3;
+#else
+       u_int8_t        dh_res:3,       /* Reserved */
+                               dh_type:4,      /* Type of message */
+                               dh_x:1;         /* long/short sequence number */
+#endif
+       u_int8_t        dh_res2;        
+       u_int16_t       dh_seq; 
+       u_int32_t       dh_seq2;        /* long sequence number */
+};
+
+struct dccp_nathdr {
+       u_int16_t       dh_sport;       /* source port */
+       u_int16_t       dh_dport;       /* destination port */
+       u_int8_t        dh_off;
+#if BYTE_ORDER == LITTLE_ENDIAN
+       u_int8_t        dh_cscov:4,     /* Checksum Length */
+                               dh_ccval:4;     /* Number of non data packets */
+#else
+       u_int8_t        dh_ccval:4,
+                               dh_cscov:4;
+#endif
+
+       u_int16_t       dh_seq;
+       u_int32_t       dh_seq2;
+};
+
+
+struct dccp_requesthdr {
+       u_int32_t       drqh_scode;     /* Service Code */
+};
+
+struct dccp_acksubhdr { 
+#if BYTE_ORDER == LITTLE_ENDIAN
+       u_int32_t       dah_res:8,  /* Reserved */
+                               dah_ack:24; /* Acknowledgement number */
+#else
+       u_int32_t       dah_ack:24,
+                               dah_res:8;
+#endif
+};
+
+struct dccp_acksublhdr {
+       u_int16_t       dah_res; /* Reserved */
+       u_int16_t       dah_ack; /* Acknowledgement number */
+       u_int32_t   dah_ack2;
+};
+
+struct dccp_ackhdr {
+       struct dccp_acksubhdr   dash;
+};
+ 
+struct dccp_acklhdr {
+       struct dccp_acksublhdr  dash;
+};
+
+struct dccp_resethdr {
+       struct dccp_acksublhdr  drth_dash;
+       u_int8_t        drth_reason;    /* Reason */
+       u_int8_t        drth_data1;     /* Data 1 */
+       u_int8_t        drth_data2;     /* Data 2 */
+       u_int8_t        drth_data3;     /* Data 3 */
+};
+
+#define DCCP_TYPE_REQUEST      0
+#define DCCP_TYPE_RESPONSE     1
+#define DCCP_TYPE_DATA         2
+#define DCCP_TYPE_ACK          3
+#define DCCP_TYPE_DATAACK      4
+#define DCCP_TYPE_CLOSEREQ     5
+#define DCCP_TYPE_CLOSE                6
+#define DCCP_TYPE_RESET                7
+#define DCCP_TYPE_MOVE         8
+
+#define DCCP_FEATURE_CC                1
+#define DCCP_FEATURE_ECN       2
+#define DCCP_FEATURE_ACKRATIO  3
+#define DCCP_FEATURE_ACKVECTOR 4
+#define DCCP_FEATURE_MOBILITY  5
+#define DCCP_FEATURE_LOSSWINDOW        6
+#define DCCP_FEATURE_CONN_NONCE        8
+#define DCCP_FEATURE_IDENTREG  7
+
+#define DCCP_OPT_PADDING               0
+#define DCCP_OPT_DATA_DISCARD  1
+#define DCCP_OPT_SLOW_RECV             2
+#define DCCP_OPT_BUF_CLOSED            3
+#define DCCP_OPT_CHANGE_L              32
+#define DCCP_OPT_CONFIRM_L             33
+#define DCCP_OPT_CHANGE_R              34
+#define DCCP_OPT_CONFIRM_R             35
+#define DCCP_OPT_INIT_COOKIE   36
+#define DCCP_OPT_NDP_COUNT             37
+#define DCCP_OPT_ACK_VECTOR0   38
+#define DCCP_OPT_ACK_VECTOR1   39
+#define DCCP_OPT_RECV_BUF_DROPS 40
+#define DCCP_OPT_TIMESTAMP             41
+#define DCCP_OPT_TIMESTAMP_ECHO 42
+#define DCCP_OPT_ELAPSEDTIME   43
+#define DCCP_OPT_DATACHECKSUM  44
+
+#define DCCP_REASON_UNSPEC     0
+#define DCCP_REASON_CLOSED     1
+#define DCCP_REASON_INVALID    2
+#define DCCP_REASON_OPTION_ERR 3
+#define DCCP_REASON_FEA_ERR    4
+#define DCCP_REASON_CONN_REF   5
+#define DCCP_REASON_BAD_SNAME  6
+#define DCCP_REASON_BAD_COOKIE 7
+#define DCCP_REASON_INV_MOVE   8
+#define DCCP_REASON_UNANSW_CH  10
+#define DCCP_REASON_FRUITLESS_NEG      11
+
+#define DCCP_CCID              0x01
+#define DCCP_CSLEN             0x02
+#define DCCP_MAXSEG            0x04
+#define DCCP_SERVICE   0x08
+
+#define DCCP_NDP_LIMIT          16
+#define DCCP_SEQ_NUM_LIMIT      16777216
+#define DCCP_MAX_OPTIONS       32
+#define DCCP_CONNECT_TIMER     (75 * hz)
+#define DCCP_CLOSE_TIMER       (75 * hz)
+#define DCCP_TIMEWAIT_TIMER    (60 * hz)
+#define DCCP_MAX_PKTS          100
+#endif
diff -r 467fe34572cc -r a1fac918076f sys/netinet/dccp_cc_sw.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/netinet/dccp_cc_sw.c  Tue Feb 10 19:11:52 2015 +0000
@@ -0,0 +1,96 @@
+/*     $KAME: dccp_cc_sw.c,v 1.9 2005/10/21 05:33:51 nishida Exp $     */
+/*     $NetBSD: dccp_cc_sw.c,v 1.1 2015/02/10 19:11:52 rjs Exp $ */
+
+/*
+ * Copyright (c) 2003  Nils-Erik Mattsson 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Id: dccp_cc_sw.c,v 1.10 2003/05/14 08:14:46 nilmat-8 Exp
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: dccp_cc_sw.c,v 1.1 2015/02/10 19:11:52 rjs Exp $");
+
+#include "opt_dccp.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/domain.h>
+#include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/malloc.h>
+#include <sys/mbuf.h>
+#include <sys/proc.h>
+#include <sys/protosw.h>
+#include <sys/signalvar.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#include <sys/mutex.h>



Home | Main Index | Thread Index | Old Index