Commit 08707d54 authored by Jon Grimm's avatar Jon Grimm

lksctp-2_5_31-0_5_1.patch

parent 5dfd412e
Linux Kernel SCTP
This is the current BETA release of the Linux Kernel SCTP reference
implementation.
SCTP (Stream Control Transmission Protocol) is a IP based, message oriented,
reliable transport protocol, with congestion control, support for
transparent multi-homing, and multiple ordered streams of messages.
RFC2960 defines the core protocol. The IETF SIGTRAN working group originally
developed the SCTP protocol and later handed the protocol over to the
Transport Area (TSVWG) working group for the continued evolvement of SCTP as a
general purpose transport.
See the IETF website (http://www.ietf.org) for further documents on SCTP.
See http://www.ietf.org/rfc/rfc2960.txt
The initial project goal is to create an Linux kernel reference implementation
of SCTP that is RFC 2960 compliant and provides an programming interface
referred to as the UDP-style API of the Sockets Extensions for SCTP, as
proposed in IETF Internet-Drafts.
Caveats:
-lksctp can be built as statically or as a module. However, be aware that
module removal of lksctp is not yet a safe activity.
-There is tentative support for IPv6, but most work has gone towards
implementation and testing lksctp on IPv4.
For more information, please visit the lksctp project website:
http://www.sf.net/projects/lksctp
Or contact the lksctp developers through the mailing list:
<lksctp-developers@lists.sourceforge.net>
...@@ -37,11 +37,12 @@ enum { ...@@ -37,11 +37,12 @@ enum {
IPPROTO_IPV6 = 41, /* IPv6-in-IPv4 tunnelling */ IPPROTO_IPV6 = 41, /* IPv6-in-IPv4 tunnelling */
IPPROTO_PIM = 103, /* Protocol Independent Multicast */
IPPROTO_ESP = 50, /* Encapsulation Security Payload protocol */ IPPROTO_ESP = 50, /* Encapsulation Security Payload protocol */
IPPROTO_AH = 51, /* Authentication Header protocol */ IPPROTO_AH = 51, /* Authentication Header protocol */
IPPROTO_PIM = 103, /* Protocol Independent Multicast */
IPPROTO_COMP = 108, /* Compression Header protocol */ IPPROTO_COMP = 108, /* Compression Header protocol */
IPPROTO_SCTP = 132, /* Stream Control Transport Protocol */
IPPROTO_RAW = 255, /* Raw IP packets */ IPPROTO_RAW = 255, /* Raw IP packets */
IPPROTO_MAX IPPROTO_MAX
......
...@@ -137,6 +137,7 @@ extern int sock_sendmsg(struct socket *, struct msghdr *m, int len); ...@@ -137,6 +137,7 @@ extern int sock_sendmsg(struct socket *, struct msghdr *m, int len);
extern int sock_recvmsg(struct socket *, struct msghdr *m, int len, int flags); extern int sock_recvmsg(struct socket *, struct msghdr *m, int len, int flags);
extern int sock_readv_writev(int type, struct inode * inode, struct file * file, extern int sock_readv_writev(int type, struct inode * inode, struct file * file,
const struct iovec * iov, long count, long size); const struct iovec * iov, long count, long size);
extern int sock_map_fd(struct socket *sock);
extern int net_ratelimit(void); extern int net_ratelimit(void);
extern unsigned long net_random(void); extern unsigned long net_random(void);
......
This diff is collapsed.
...@@ -227,6 +227,7 @@ struct ucred { ...@@ -227,6 +227,7 @@ struct ucred {
#define SOL_UDP 17 #define SOL_UDP 17
#define SOL_IPV6 41 #define SOL_IPV6 41
#define SOL_ICMPV6 58 #define SOL_ICMPV6 58
#define SOL_SCTP 132
#define SOL_RAW 255 #define SOL_RAW 255
#define SOL_IPX 256 #define SOL_IPX 256
#define SOL_AX25 257 #define SOL_AX25 257
......
...@@ -172,6 +172,7 @@ enum ...@@ -172,6 +172,7 @@ enum
NET_TR=14, NET_TR=14,
NET_DECNET=15, NET_DECNET=15,
NET_ECONET=16, NET_ECONET=16,
NET_SCTP=17,
}; };
/* /proc/sys/kernel/random */ /* /proc/sys/kernel/random */
...@@ -516,6 +517,21 @@ enum { ...@@ -516,6 +517,21 @@ enum {
NET_DECNET_CONF_DEV_STATE = 7 NET_DECNET_CONF_DEV_STATE = 7
}; };
/* /proc/sys/net/sctp */
enum {
NET_SCTP_RTO_INITIAL = 1,
NET_SCTP_RTO_MIN = 2,
NET_SCTP_RTO_MAX = 3,
NET_SCTP_RTO_ALPHA = 4,
NET_SCTP_RTO_BETA = 5,
NET_SCTP_VALID_COOKIE_LIFE = 6,
NET_SCTP_ASSOCIATION_MAX_RETRANS = 7,
NET_SCTP_PATH_MAX_RETRANS = 8,
NET_SCTP_MAX_INIT_RETRANSMITS = 9,
NET_SCTP_HB_INTERVAL = 10,
NET_SCTP_MAX_BURST = 11,
};
/* CTL_PROC names: */ /* CTL_PROC names: */
/* CTL_FS names: */ /* CTL_FS names: */
......
...@@ -43,6 +43,14 @@ extern void inet_sock_release(struct sock *sk); ...@@ -43,6 +43,14 @@ extern void inet_sock_release(struct sock *sk);
extern void inet_sock_destruct(struct sock *sk); extern void inet_sock_destruct(struct sock *sk);
extern atomic_t inet_sock_nr; extern atomic_t inet_sock_nr;
extern int inet_bind(struct socket *sock,
struct sockaddr *uaddr, int addr_len);
extern int inet_getname(struct socket *sock,
struct sockaddr *uaddr,
int *uaddr_len, int peer);
extern int inet_ioctl(struct socket *sock,
unsigned int cmd, unsigned long arg);
#endif #endif
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Authors: * Authors:
* Pedro Roque <roque@di.fc.ul.pt> * Pedro Roque <roque@di.fc.ul.pt>
* *
* $Id: ipv6.h,v 1.23 2000/12/13 18:31:48 davem Exp $ * $Id: ipv6.h,v 1.1 2002/05/20 15:13:07 jgrimm Exp $
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -336,6 +336,14 @@ extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, u16 ...@@ -336,6 +336,14 @@ extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, u16
u32 info, u8 *payload); u32 info, u8 *payload);
extern void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info); extern void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info);
extern int inet6_release(struct socket *sock);
extern int inet6_bind(struct socket *sock, struct sockaddr *uaddr,
int addr_len);
extern int inet6_getname(struct socket *sock, struct sockaddr *uaddr,
int *uaddr_len, int peer);
extern int inet6_ioctl(struct socket *sock, unsigned int cmd,
unsigned long arg);
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* _NET_IPV6_H */ #endif /* _NET_IPV6_H */
......
This diff is collapsed.
/* SCTP kernel reference Implementation Copyright (C) 1999-2001
* Cisco, Motorola, and IBM
*
* This file is part of the SCTP kernel reference Implementation
*
* $Header: /cvsroot/lksctp/lksctp/sctp_cvs/include/net/sctp/sctp_command.h,v 1.19 2002/08/16 19:30:49 jgrimm Exp $
*
* These are the definitions needed for the command object.
*
* The SCTP reference implementation is free software;
* you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* the SCTP reference implementation is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* ************************
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU CC; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Please send any bug reports or fixes you make to one of the
* following email addresses:
*
* La Monte H.P. Yarroll <piggy@acm.org>
* Karl Knutson <karl@athena.chicago.il.us>
*
* Any bugs reported given to us we will try to fix... any fixes shared will
* be incorporated into the next SCTP release.
*/
#ifndef __net_sctp_command_h__
#define __net_sctp_command_h__
#include <net/sctp/sctp_constants.h>
#include <net/sctp/sctp_structs.h>
typedef enum {
SCTP_CMD_NOP = 0, /* Do nothing. */
SCTP_CMD_NEW_ASOC, /* Register a new association. */
SCTP_CMD_DELETE_TCB, /* Delete the current association. */
SCTP_CMD_NEW_STATE, /* Enter a new state. */
SCTP_CMD_REPORT_TSN, /* Record the arrival of a TSN. */
SCTP_CMD_GEN_SACK, /* Send a Selective ACK (maybe). */
SCTP_CMD_PROCESS_SACK, /* Process an inbound SACK. */
SCTP_CMD_GEN_INIT_ACK, /* Generate an INIT ACK chunk. */
SCTP_CMD_PEER_INIT, /* Process a INIT from the peer. */
SCTP_CMD_GEN_COOKIE_ECHO, /* Generate a COOKIE ECHO chunk. */
SCTP_CMD_CHUNK_ULP, /* Send a chunk to the sockets layer. */
SCTP_CMD_EVENT_ULP, /* Send a notification to the sockets layer. */
SCTP_CMD_REPLY, /* Send a chunk to our peer. */
SCTP_CMD_SEND_PKT, /* Send a full packet to our peer. */
SCTP_CMD_RETRAN, /* Mark a transport for retransmission. */
SCTP_CMD_ECN_CE, /* Do delayed CE processing. */
SCTP_CMD_ECN_ECNE, /* Do delayed ECNE processing. */
SCTP_CMD_ECN_CWR, /* Do delayed CWR processing. */
SCTP_CMD_TIMER_START, /* Start a timer. */
SCTP_CMD_TIMER_RESTART, /* Restart a timer. */
SCTP_CMD_TIMER_STOP, /* Stop a timer. */
SCTP_CMD_COUNTER_RESET, /* Reset a counter. */
SCTP_CMD_COUNTER_INC, /* Increment a counter. */
SCTP_CMD_INIT_RESTART, /* High level, do init timer work. */
SCTP_CMD_INIT_FAILED, /* High level, do init failure work. */
SCTP_CMD_REPORT_DUP, /* Report a duplicate TSN. */
SCTP_CMD_REPORT_BIGGAP, /* Narc on a TSN (it was too high). */
SCTP_CMD_SET_BIND_ADDR, /* Set the association bind_addr. */
SCTP_CMD_STRIKE, /* Mark a strike against a transport. */
SCTP_CMD_TRANSMIT, /* Transmit the outqueue. */
SCTP_CMD_HB_TIMERS_START, /* Start the heartbeat timers. */
SCTP_CMD_TRANSPORT_RESET, /* Reset the status of a transport. */
SCTP_CMD_TRANSPORT_ON, /* Mark the transport as active. */
SCTP_CMD_REPORT_ERROR, /* Pass this error back out of the sm. */
SCTP_CMD_REPORT_BAD_TAG, /* Verification tags didn't match. */
SCTP_CMD_PROCESS_CTSN, /* Sideeffect from shutdown. */
SCTP_CMD_ASSOC_FAILED, /* Handle association failure. */
SCTP_CMD_DISCARD_PACKET, /* Discard the whole packet. */
SCTP_CMD_GEN_SHUTDOWN, /* Generate a SHUTDOWN chunk. */
SCTP_CMD_UPDATE_ASSOC, /* Update association information. */
SCTP_CMD_PURGE_OUTQUEUE, /* Purge all data waiting to be sent. */
SCTP_CMD_SETUP_T2, /* Hi-level, setup T2-shutdown parms. */
SCTP_CMD_LAST
} sctp_verb_t; /* enum */
#define SCTP_CMD_MAX (SCTP_CMD_LAST - 1)
#define SCTP_CMD_NUM_VERBS (SCTP_CMD_MAX + 1)
/* How many commands can you put in an sctp_cmd_seq_t?
* This is a rather arbitrary number, ideally derived from a careful
* analysis of the state functions, but in reality just taken from
* thin air in the hopes othat we don't trigger a kernel panic.
*/
#define SCTP_MAX_NUM_COMMANDS 14
typedef union {
int32_t i32;
uint32_t u32;
uint16_t u16;
uint8_t u8;
int error;
sctp_state_t state;
sctp_event_timeout_t to;
sctp_counter_t counter;
void *ptr;
sctp_chunk_t *chunk;
sctp_association_t *asoc;
sctp_transport_t *transport;
sctp_bind_addr_t *bp;
sctp_init_chunk_t *init;
sctp_ulpevent_t *ulpevent;
sctp_packet_t *packet;
sctp_sackhdr_t *sackh;
} sctp_arg_t;
/* We are simulating ML type constructors here.
*
* SCTP_ARG_CONSTRUCTOR(NAME, TYPE, ELT) builds a function called
* SCTP_NAME() which takes an argument of type TYPE and returns an
* sctp_arg_t. It does this by inserting the sole argument into the
* ELT union element of a local sctp_arg_t.
*
* E.g., SCTP_ARG_CONSTRUCTOR(I32, int32_t, i32) builds SCTP_I32(arg),
* which takes an int32_t and returns a sctp_arg_t containing the
* int32_t. So, after foo = SCTP_I32(arg), foo.i32 == arg.
*/
static inline sctp_arg_t
SCTP_NULL(void)
{
sctp_arg_t retval; retval.ptr = NULL; return(retval);
}
static inline sctp_arg_t
SCTP_NOFORCE(void)
{
sctp_arg_t retval; retval.i32 = 0; return(retval);
}
static inline sctp_arg_t
SCTP_FORCE(void)
{
sctp_arg_t retval; retval.i32 = 1; return(retval);
}
#define SCTP_ARG_CONSTRUCTOR(name, type, elt) \
static inline sctp_arg_t \
SCTP_## name (type arg) \
{ sctp_arg_t retval; retval.elt = arg; return(retval); }
SCTP_ARG_CONSTRUCTOR(I32, int32_t, i32)
SCTP_ARG_CONSTRUCTOR(U32, int32_t, u32)
SCTP_ARG_CONSTRUCTOR(U16, int32_t, u16)
SCTP_ARG_CONSTRUCTOR(U8, int32_t, u8)
SCTP_ARG_CONSTRUCTOR(ERROR, int, error)
SCTP_ARG_CONSTRUCTOR(STATE, sctp_state_t, state)
SCTP_ARG_CONSTRUCTOR(COUNTER, sctp_counter_t, counter)
SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to)
SCTP_ARG_CONSTRUCTOR(PTR, void *, ptr)
SCTP_ARG_CONSTRUCTOR(CHUNK, sctp_chunk_t *, chunk)
SCTP_ARG_CONSTRUCTOR(ASOC, sctp_association_t *, asoc)
SCTP_ARG_CONSTRUCTOR(TRANSPORT, sctp_transport_t *, transport)
SCTP_ARG_CONSTRUCTOR(BA, sctp_bind_addr_t *, bp)
SCTP_ARG_CONSTRUCTOR(PEER_INIT, sctp_init_chunk_t *, init)
SCTP_ARG_CONSTRUCTOR(ULPEVENT, sctp_ulpevent_t *, ulpevent)
SCTP_ARG_CONSTRUCTOR(PACKET, sctp_packet_t *, packet)
SCTP_ARG_CONSTRUCTOR(SACKH, sctp_sackhdr_t *, sackh)
typedef struct {
sctp_arg_t obj;
sctp_verb_t verb;
} sctp_cmd_t;
typedef struct {
sctp_cmd_t cmds[SCTP_MAX_NUM_COMMANDS];
uint8_t next_free_slot;
uint8_t next_cmd;
} sctp_cmd_seq_t;
/* Create a new sctp_command_sequence.
* Return NULL if creating a new sequence fails.
*/
sctp_cmd_seq_t *sctp_new_cmd_seq(int priority);
/* Initialize a block of memory as a command sequence.
* Return 0 if the initialization fails.
*/
int sctp_init_cmd_seq(sctp_cmd_seq_t *seq);
/* Add a command to an sctp_cmd_seq_t.
* Return 0 if the command sequence is full.
*
* Use the SCTP_* constructors defined by SCTP_ARG_CONSTRUCTOR() above
* to wrap data which goes in the obj argument.
*/
int sctp_add_cmd(sctp_cmd_seq_t *seq, sctp_verb_t verb, sctp_arg_t obj);
/* Rewind an sctp_cmd_seq_t to iterate from the start.
* Return 0 if the rewind fails.
*/
int sctp_rewind_sequence(sctp_cmd_seq_t *seq);
/* Return the next command structure in an sctp_cmd_seq.
* Return NULL at the end of the sequence.
*/
sctp_cmd_t *sctp_next_cmd(sctp_cmd_seq_t *seq);
/* Dispose of a command sequence. */
void sctp_free_cmd_seq(sctp_cmd_seq_t *seq);
#endif /* __net_sctp_command_h__ */
This diff is collapsed.
/* SCTP reference Implementation
* Copyright (C) 1999 Cisco, Inc.
* Copyright (C) 1999 Motorola, Inc.
*
* This file originates from Randy Stewart's SCTP reference Implementation.
*
* The SCTP reference implementation is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* ************************
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU CC; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Please send any bug reports or fixes you make to the
* email address(es):
* lksctp developers <lksctp-developers@lists.sourceforge.net>
*
* Or submit a bug report through the following website:
* http://www.sf.net/projects/lksctp
*
* Written or modified by:
* Randy Stewart <rstewar1@email.mot.com>
* Ken Morneau <kmorneau@cisco.com>
* Qiaobing Xie <qxie1@email.mot.com>
*/
#ifndef __SLA1_h__
#define __SLA1_h__
#ifdef __cplusplus
extern "C" {
#endif
struct SLA_1_Context{
unsigned int A;
unsigned int B;
unsigned int C;
unsigned int D;
unsigned int E;
unsigned int H0;
unsigned int H1;
unsigned int H2;
unsigned int H3;
unsigned int H4;
unsigned int words[80];
unsigned int TEMP;
/* block I am collecting to process */
char SLAblock[64];
/* collected so far */
int howManyInBlock;
unsigned int runningTotal;
};
#define F1(B,C,D) (((B & C) | ((~B) & D))) /* 0 <= t <= 19 */
#define F2(B,C,D) (B ^ C ^ D) /* 20 <= t <= 39 */
#define F3(B,C,D) ((B & C) | (B & D) | (C & D)) /* 40 <= t <= 59 */
#define F4(B,C,D) (B ^ C ^ D) /*600 <= t <= 79 */
/* circular shift */
#define CSHIFT(A,B) ((B << A) | (B >> (32-A)))
#define K1 0x5a827999 /* 0 <= t <= 19 */
#define K2 0x6ed9eba1 /* 20 <= t <= 39 */
#define K3 0x8f1bbcdc /* 40 <= t <= 59 */
#define K4 0xca62c1d6 /* 60 <= t <= 79 */
#define H0INIT 0x67452301
#define H1INIT 0xefcdab89
#define H2INIT 0x98badcfe
#define H3INIT 0x10325476
#define H4INIT 0xc3d2e1f0
extern void SLA1_Init(struct SLA_1_Context *);
extern void SLA1_Process(struct SLA_1_Context *, const unsigned char *, int);
extern void SLA1_Final(struct SLA_1_Context *, unsigned char *);
#ifdef __cplusplus
}
#endif
#endif
This diff is collapsed.
This diff is collapsed.
/* SCTP kernel reference Implementation Copyright (C) 1999-2001
* Cisco, Motorola, Intel, and International Business Machines Corp.
*
* This file is part of the SCTP kernel reference Implementation
*
* $Header: /cvsroot/lksctp/lksctp/sctp_cvs/include/net/sctp/sctp_tsnmap.h,v 1.8 2002/07/16 14:51:58 jgrimm Exp $
*
* These are the definitions needed for the tsnmap type. The tsnmap is used
* to track out of order TSNs received.
*
* The SCTP reference implementation is free software;
* you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* the SCTP reference implementation is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* ************************
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU CC; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Please send any bug reports or fixes you make to one of the
* following email addresses:
*
* Jon Grimm <jgrimm@us.ibm.com>
* La Monte H.P. Yarroll <piggy@acm.org>
* Karl Knutson <karl@athena.chicago.il.us>
*
* Any bugs reported given to us we will try to fix... any fixes shared will
* be incorporated into the next SCTP release.
*/
#include <net/sctp/sctp_constants.h>
#ifndef __sctp_tsnmap_h__
#define __sctp_tsnmap_h__
/* RFC 2960 12.2 Parameters necessary per association (i.e. the TCB)
* Mapping An array of bits or bytes indicating which out of
* Array order TSN's have been received (relative to the
* Last Rcvd TSN). If no gaps exist, i.e. no out of
* order packets have been received, this array
* will be set to all zero. This structure may be
* in the form of a circular buffer or bit array.
*/
typedef struct sctp_tsnmap {
/* This array counts the number of chunks with each TSN.
* It points at one of the two buffers with which we will
* ping-pong between.
*/
uint8_t *tsn_map;
/* This marks the tsn which overflows the tsn_map, when the
* cumulative ack point reaches this point we know we can switch
* maps (tsn_map and overflow_map swap).
*/
uint32_t overflow_tsn;
/* This is the overflow array for tsn_map.
* It points at one of the other ping-pong buffers.
*/
uint8_t *overflow_map;
/* This is the TSN at tsn_map[0]. */
uint32_t base_tsn;
/* Last Rcvd : This is the last TSN received in
* TSN : sequence. This value is set initially by
* : taking the peer's Initial TSN, received in
* : the INIT or INIT ACK chunk, and subtracting
* : one from it.
*
* Throughout most of the specification this is called the
* "Cumulative TSN ACK Point". In this case, we
* ignore the advice in 12.2 in favour of the term
* used in the bulk of the text.
*/
uint32_t cumulative_tsn_ack_point;
/* This is the minimum number of TSNs we can track. This corresponds
* to the size of tsn_map. Note: the overflow_map allows us to
* potentially track more than this quantity.
*/
uint16_t len;
/* This is the highest TSN we've marked. */
uint32_t max_tsn_seen;
/* No. of data chunks pending receipt. used by SCTP_STATUS sockopt */
uint16_t pending_data;
int malloced;
uint8_t raw_map[0];
} sctp_tsnmap_t;
typedef struct sctp_tsnmap_iter {
uint32_t start;
} sctp_tsnmap_iter_t;
/* Create a new tsnmap. */
sctp_tsnmap_t *sctp_tsnmap_new(uint16_t len, uint32_t initial_tsn,
int priority);
/* Dispose of a tsnmap. */
void sctp_tsnmap_free(sctp_tsnmap_t *map);
/* This macro assists in creation of external storage for variable length
* internal buffers. We double allocate so the overflow map works.
*/
#define sctp_tsnmap_storage_size(count) (sizeof(uint8_t) * (count) * 2)
/* Initialize a block of memory as a tsnmap. */
sctp_tsnmap_t *sctp_tsnmap_init(sctp_tsnmap_t *map, uint16_t len,
uint32_t initial_tsn);
/* Test the tracking state of this TSN.
* Returns:
* 0 if the TSN has not yet been seen
* >0 if the TSN has been seen (duplicate)
* <0 if the TSN is invalid (too large to track)
*/
int sctp_tsnmap_check(const sctp_tsnmap_t *map, uint32_t tsn);
/* Mark this TSN as seen. */
void sctp_tsnmap_mark(sctp_tsnmap_t *map, uint32_t tsn);
/* Retrieve the Cumulative TSN ACK Point. */
uint32_t sctp_tsnmap_get_ctsn(const sctp_tsnmap_t *map);
/* Retrieve the highest TSN we've seen. */
uint32_t sctp_tsnmap_get_max_tsn_seen(const sctp_tsnmap_t *map);
/* Is there a gap in the TSN map? */
int sctp_tsnmap_has_gap(const sctp_tsnmap_t *map);
/* Initialize a gap ack block interator from user-provided memory. */
void sctp_tsnmap_iter_init(const sctp_tsnmap_t *map, sctp_tsnmap_iter_t *iter);
/* Get the next gap ack blocks. We return 0 if there are no more
* gap ack blocks.
*/
int
sctp_tsnmap_next_gap_ack(const sctp_tsnmap_t *map, sctp_tsnmap_iter_t *iter,
uint16_t *start, uint16_t *end);
#endif /* __sctp_tsnmap_h__ */
/* SCTP kernel reference Implementation
* Copyright (c) 1999-2000 Cisco, Inc.
* Copyright (c) 1999-2001 Motorola, Inc.
* Copyright (c) 2001 International Business Machines, Corp.
* Copyright (c) 2001 Intel Corp.
* Copyright (c) 2001 Nokia, Inc.
* Copyright (c) 2001 La Monte H.P. Yarroll
*
* $Header: /cvsroot/lksctp/lksctp/sctp_cvs/include/net/sctp/sctp_ulpevent.h,v 1.5 2002/07/12 14:50:25 jgrimm Exp $
*
* These are the definitions needed for the sctp_ulpevent type. The
* sctp_ulpevent type is used to carry information from the state machine
* upwards to the ULP.
*
* The SCTP reference implementation is free software;
* you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* the SCTP reference implementation is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* ************************
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU CC; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Please send any bug reports or fixes you make to one of the
* following email addresses:
*
* Jon Grimm <jgrimm@us.ibm.com>
* La Monte H.P. Yarroll <piggy@acm.org>
* Karl Knutson <karl@athena.chicago.il.us>
*
* Any bugs reported given to us we will try to fix... any fixes shared will
* be incorporated into the next SCTP release.
*/
#ifndef __sctp_ulpevent_h__
#define __sctp_ulpevent_h__
/* A structure to carry information to the ULP (e.g. Sockets API) */
/* Warning: This sits inside an skb.cb[] area. Be very careful of
* growing this structure as it is at the maximum limit now.
*/
typedef struct sctp_ulpevent {
int malloced;
sctp_association_t *asoc;
struct sk_buff *parent;
struct sctp_sndrcvinfo sndrcvinfo;
int chunk_flags; /* Temp. until we get a new chunk_t */
int msg_flags;
} sctp_ulpevent_t;
sctp_ulpevent_t *
sctp_ulpevent_new(int size, int msg_flags, int priority);
sctp_ulpevent_t *
sctp_ulpevent_init(sctp_ulpevent_t *event, struct sk_buff *skb, int msg_flags);
void
sctp_ulpevent_free(sctp_ulpevent_t *event);
int
sctp_ulpevent_is_notification(const sctp_ulpevent_t *event);
sctp_ulpevent_t *
sctp_ulpevent_make_assoc_change(const struct SCTP_association *asoc,
uint16_t flags,
uint16_t state,
uint16_t error,
uint16_t outbound,
uint16_t inbound,
int priority);
sctp_ulpevent_t *
sctp_ulpevent_make_peer_addr_change(const struct SCTP_association *asoc,
const struct sockaddr_storage *aaddr,
int flags,
int state,
int error,
int priority);
sctp_ulpevent_t *
sctp_ulpevent_make_remote_error(const struct SCTP_association *asoc,
struct SCTP_chunk *chunk,
uint16_t flags,
int priority);
sctp_ulpevent_t *
sctp_ulpevent_make_send_failed(const struct SCTP_association *asoc,
struct SCTP_chunk *chunk,
uint16_t flags,
uint32_t error,
int priority);
sctp_ulpevent_t *
sctp_ulpevent_make_shutdown_event(const struct SCTP_association *asoc,
uint16_t flags,
int priority);
sctp_ulpevent_t *
sctp_ulpevent_make_rcvmsg(struct SCTP_association *asoc,
struct SCTP_chunk *chunk,
int priority);
void
sctp_ulpevent_read_sndrcvinfo(const sctp_ulpevent_t *event,
struct msghdr *msghdr);
uint16_t
sctp_ulpevent_get_notification_type(const sctp_ulpevent_t *event);
/* Given an event subscription, is this event enabled? */
static inline int
sctp_ulpevent_is_enabled(const sctp_ulpevent_t *event,
const struct sctp_event_subscribe *mask)
{
const char *amask = (const char *)mask;
uint16_t sn_type;
int enabled = 1;
if (sctp_ulpevent_is_notification(event)) {
sn_type = sctp_ulpevent_get_notification_type(event);
enabled = amask[sn_type - SCTP_SN_TYPE_BASE];
}
return(enabled);
} /* sctp_ulpevent_is_enabled() */
#endif /* __sctp_ulpevent_h__ */
/* SCTP kernel reference Implementation
* Copyright (c) 1999-2000 Cisco, Inc.
* Copyright (c) 1999-2001 Motorola, Inc.
* Copyright (c) 2001 International Business Machines, Corp.
* Copyright (c) 2001 Intel Corp.
* Copyright (c) 2001 Nokia, Inc.
* Copyright (c) 2001 La Monte H.P. Yarroll
*
* $Header: /cvsroot/lksctp/lksctp/sctp_cvs/include/net/sctp/sctp_ulpqueue.h,v 1.2 2002/07/12 14:50:25 jgrimm Exp $
*
* These are the definitions needed for the sctp_ulpqueue type. The
* sctp_ulpqueue is the interface between the Upper Layer Protocol, or ULP,
* and the core SCTP state machine. This is the component which handles
* reassembly and ordering.
*
* The SCTP reference implementation is free software;
* you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* the SCTP reference implementation is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* ************************
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU CC; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Please send any bug reports or fixes you make to one of the
* following email addresses:
*
* Jon Grimm <jgrimm@us.ibm.com>
* La Monte H.P. Yarroll <piggy@acm.org>
*
* Any bugs reported given to us we will try to fix... any fixes shared will
* be incorporated into the next SCTP release.
*/
#ifndef __sctp_ulpqueue_h__
#define __sctp_ulpqueue_h__
/* A structure to carry information to the ULP (e.g. Sockets API) */
typedef struct sctp_ulpqueue {
int malloced;
spinlock_t lock;
sctp_association_t *asoc;
struct sk_buff_head reasm;
struct sk_buff_head lobby;
uint16_t ssn[0];
} sctp_ulpqueue_t;
/* This macro assists in creation of external storage for variable length
* internal buffers.
*/
#define sctp_ulpqueue_storage_size(inbound) (sizeof(uint16_t) * (inbound))
sctp_ulpqueue_t *
sctp_ulpqueue_new(sctp_association_t *asoc,
uint16_t inbound,
int priority);
sctp_ulpqueue_t *
sctp_ulpqueue_init(sctp_ulpqueue_t *ulpq,
sctp_association_t *asoc,
uint16_t inbound);
void
sctp_ulpqueue_free(sctp_ulpqueue_t *);
/* Add a new DATA chunk for processing. */
int
sctp_ulpqueue_tail_data(sctp_ulpqueue_t *,
sctp_chunk_t *chunk,
int priority);
/* Add a new event for propogation to the ULP. */
int
sctp_ulpqueue_tail_event(sctp_ulpqueue_t *,
sctp_ulpevent_t *event);
/* Is the ulpqueue empty. */
int
sctp_ulpqueue_is_empty(sctp_ulpqueue_t *);
int
sctp_ulpqueue_is_data_empty(sctp_ulpqueue_t *);
#endif /* __sctp_ulpqueue_h__ */
This diff is collapsed.
...@@ -26,6 +26,9 @@ if [ "$CONFIG_INET" = "y" ]; then ...@@ -26,6 +26,9 @@ if [ "$CONFIG_INET" = "y" ]; then
source net/ipv6/Config.in source net/ipv6/Config.in
fi fi
fi fi
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
source net/sctp/Config.in
fi
fi fi
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
bool 'Asynchronous Transfer Mode (ATM) (EXPERIMENTAL)' CONFIG_ATM bool 'Asynchronous Transfer Mode (ATM) (EXPERIMENTAL)' CONFIG_ATM
......
...@@ -35,6 +35,7 @@ obj-$(CONFIG_DECNET) += decnet/ ...@@ -35,6 +35,7 @@ obj-$(CONFIG_DECNET) += decnet/
obj-$(CONFIG_ECONET) += econet/ obj-$(CONFIG_ECONET) += econet/
obj-$(CONFIG_VLAN_8021Q) += 8021q/ obj-$(CONFIG_VLAN_8021Q) += 8021q/
obj-$(CONFIG_LLC) += llc/ obj-$(CONFIG_LLC) += llc/
obj-$(CONFIG_IP_SCTP) += sctp/
ifeq ($(CONFIG_NET),y) ifeq ($(CONFIG_NET),y)
obj-$(CONFIG_MODULES) += netsyms.o obj-$(CONFIG_MODULES) += netsyms.o
......
...@@ -493,7 +493,7 @@ int inet_release(struct socket *sock) ...@@ -493,7 +493,7 @@ int inet_release(struct socket *sock)
/* It is off by default, see below. */ /* It is off by default, see below. */
int sysctl_ip_nonlocal_bind; int sysctl_ip_nonlocal_bind;
static int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
{ {
struct sockaddr_in *addr = (struct sockaddr_in *)uaddr; struct sockaddr_in *addr = (struct sockaddr_in *)uaddr;
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
...@@ -729,7 +729,7 @@ int inet_accept(struct socket *sock, struct socket *newsock, int flags) ...@@ -729,7 +729,7 @@ int inet_accept(struct socket *sock, struct socket *newsock, int flags)
/* /*
* This does both peername and sockname. * This does both peername and sockname.
*/ */
static int inet_getname(struct socket *sock, struct sockaddr *uaddr, int inet_getname(struct socket *sock, struct sockaddr *uaddr,
int *uaddr_len, int peer) int *uaddr_len, int peer)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
...@@ -846,7 +846,7 @@ int inet_shutdown(struct socket *sock, int how) ...@@ -846,7 +846,7 @@ int inet_shutdown(struct socket *sock, int how)
* There's a good 20K of config code hanging around the kernel. * There's a good 20K of config code hanging around the kernel.
*/ */
static int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
int err = 0; int err = 0;
......
...@@ -274,7 +274,7 @@ static int inet6_create(struct socket *sock, int protocol) ...@@ -274,7 +274,7 @@ static int inet6_create(struct socket *sock, int protocol)
/* bind for INET6 API */ /* bind for INET6 API */
static int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
{ {
struct sockaddr_in6 *addr=(struct sockaddr_in6 *)uaddr; struct sockaddr_in6 *addr=(struct sockaddr_in6 *)uaddr;
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
...@@ -370,7 +370,7 @@ static int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -370,7 +370,7 @@ static int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
return 0; return 0;
} }
static int inet6_release(struct socket *sock) int inet6_release(struct socket *sock)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
...@@ -415,7 +415,7 @@ int inet6_destroy_sock(struct sock *sk) ...@@ -415,7 +415,7 @@ int inet6_destroy_sock(struct sock *sk)
* This does both peername and sockname. * This does both peername and sockname.
*/ */
static int inet6_getname(struct socket *sock, struct sockaddr *uaddr, int inet6_getname(struct socket *sock, struct sockaddr *uaddr,
int *uaddr_len, int peer) int *uaddr_len, int peer)
{ {
struct sockaddr_in6 *sin=(struct sockaddr_in6 *)uaddr; struct sockaddr_in6 *sin=(struct sockaddr_in6 *)uaddr;
...@@ -451,7 +451,7 @@ static int inet6_getname(struct socket *sock, struct sockaddr *uaddr, ...@@ -451,7 +451,7 @@ static int inet6_getname(struct socket *sock, struct sockaddr *uaddr,
return(0); return(0);
} }
static int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
int err = -EINVAL; int err = -EINVAL;
...@@ -547,7 +547,7 @@ struct proto_ops inet6_dgram_ops = { ...@@ -547,7 +547,7 @@ struct proto_ops inet6_dgram_ops = {
.sendpage = sock_no_sendpage, .sendpage = sock_no_sendpage,
}; };
static struct net_proto_family inet6_family_ops = { struct net_proto_family inet6_family_ops = {
.family =PF_INET6, .family =PF_INET6,
.create =inet6_create, .create =inet6_create,
}; };
......
#include <linux/module.h> #include <linux/module.h>
#include <net/protocol.h>
#include <net/ipv6.h> #include <net/ipv6.h>
#include <net/addrconf.h> #include <net/addrconf.h>
#include <net/ip6_route.h> #include <net/ip6_route.h>
...@@ -10,3 +11,16 @@ EXPORT_SYMBOL(ndisc_mc_map); ...@@ -10,3 +11,16 @@ EXPORT_SYMBOL(ndisc_mc_map);
EXPORT_SYMBOL(register_inet6addr_notifier); EXPORT_SYMBOL(register_inet6addr_notifier);
EXPORT_SYMBOL(unregister_inet6addr_notifier); EXPORT_SYMBOL(unregister_inet6addr_notifier);
EXPORT_SYMBOL(ip6_route_output); EXPORT_SYMBOL(ip6_route_output);
EXPORT_SYMBOL(addrconf_lock);
EXPORT_SYMBOL(ipv6_setsockopt);
EXPORT_SYMBOL(ipv6_getsockopt);
EXPORT_SYMBOL(inet6_register_protosw);
EXPORT_SYMBOL(inet6_unregister_protosw);
EXPORT_SYMBOL(inet6_add_protocol);
EXPORT_SYMBOL(inet6_del_protocol);
EXPORT_SYMBOL(ip6_xmit);
EXPORT_SYMBOL(inet6_release);
EXPORT_SYMBOL(inet6_bind);
EXPORT_SYMBOL(inet6_getname);
EXPORT_SYMBOL(inet6_ioctl);
EXPORT_SYMBOL(ipv6_get_saddr);
...@@ -56,7 +56,8 @@ extern __u32 sysctl_rmem_max; ...@@ -56,7 +56,8 @@ extern __u32 sysctl_rmem_max;
extern struct net_proto_family inet_family_ops; extern struct net_proto_family inet_family_ops;
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) \
|| defined (CONFIG_IP_SCTP_MODULE)
#include <linux/in6.h> #include <linux/in6.h>
#include <linux/icmpv6.h> #include <linux/icmpv6.h>
#include <net/ipv6.h> #include <net/ipv6.h>
...@@ -159,6 +160,7 @@ EXPORT_SYMBOL(datagram_poll); ...@@ -159,6 +160,7 @@ EXPORT_SYMBOL(datagram_poll);
EXPORT_SYMBOL(put_cmsg); EXPORT_SYMBOL(put_cmsg);
EXPORT_SYMBOL(sock_kmalloc); EXPORT_SYMBOL(sock_kmalloc);
EXPORT_SYMBOL(sock_kfree_s); EXPORT_SYMBOL(sock_kfree_s);
EXPORT_SYMBOL(sock_map_fd);
#ifdef CONFIG_FILTER #ifdef CONFIG_FILTER
EXPORT_SYMBOL(sk_run_filter); EXPORT_SYMBOL(sk_run_filter);
...@@ -286,7 +288,7 @@ EXPORT_SYMBOL(dlci_ioctl_hook); ...@@ -286,7 +288,7 @@ EXPORT_SYMBOL(dlci_ioctl_hook);
#endif #endif
#if defined (CONFIG_IPV6_MODULE) #if defined (CONFIG_IPV6_MODULE) || defined (CONFIG_IP_SCTP_MODULE)
/* inet functions common to v4 and v6 */ /* inet functions common to v4 and v6 */
EXPORT_SYMBOL(inet_release); EXPORT_SYMBOL(inet_release);
EXPORT_SYMBOL(inet_stream_connect); EXPORT_SYMBOL(inet_stream_connect);
...@@ -397,6 +399,14 @@ EXPORT_SYMBOL(sysctl_max_syn_backlog); ...@@ -397,6 +399,14 @@ EXPORT_SYMBOL(sysctl_max_syn_backlog);
EXPORT_SYMBOL(tcp_read_sock); EXPORT_SYMBOL(tcp_read_sock);
#ifdef CONFIG_IP_SCTP_MODULE
EXPORT_SYMBOL(ip_setsockopt);
EXPORT_SYMBOL(ip_getsockopt);
EXPORT_SYMBOL(inet_ioctl);
EXPORT_SYMBOL(inet_bind);
EXPORT_SYMBOL(inet_getname);
#endif /* CONFIG_IP_SCTP_MODULE */
EXPORT_SYMBOL(netlink_set_err); EXPORT_SYMBOL(netlink_set_err);
EXPORT_SYMBOL(netlink_broadcast); EXPORT_SYMBOL(netlink_broadcast);
EXPORT_SYMBOL(netlink_unicast); EXPORT_SYMBOL(netlink_unicast);
......
CONFIG_IP_SCTP
Stream Control Transmission Protocol
From RFC 2960 (http://www.ietf.org/rfc/rfc2960.txt)
"SCTP is a reliable transport protocol operating on top of a
connectionless packet network such as IP. It offers the following
services to its users:
-- acknowledged error-free non-duplicated transfer of user data,
-- data fragmentation to conform to discovered path MTU size,
-- sequenced delivery of user messages within multiple streams,
with an option for order-of-arrival delivery of individual user
messages,
-- optional bundling of multiple user messages into a single SCTP
packet, and
-- network-level fault tolerance through supporting of multi-
homing at either or both ends of an association."
If in doubt, say N.
CONFIG_SCTP_ADLER32
RCF2960 currently specifies the Adler-32 checksum algorithm for SCTP.
This has been deprecated and replaced by an algorithm now referred
to as crc32c.
If you say Y, this will use the Adler-32 algorithm, this might be useful
for interoperation with downlevel peers.
If unsure, say N.
CONFIG_SCTP_DBG_MSG
If you say Y, this will enable verbose debugging messages.
If unsure, say N. However, if you are running into problems, use this
option to gather detailed trace information
CONFIG_SCTP_DBG_OBJCNT
If you say Y, this will enable debugging support for counting the types
of objects that are currently allocated. This is useful for identifying
memory leaks. If the /proc filesystem is enabled this debug information
can be viewed by 'cat /proc/net/sctp/sctp_dbg_objcnt'
If unsure, say N
#
# SCTP configuration
#
mainmenu_option next_comment
comment ' SCTP Configuration (EXPERIMENTAL)'
if [ "$CONFIG_IPV6" != "n" ]; then
define_bool CONFIG_IPV6_SCTP__ $CONFIG_IPV6
else
define_bool CONFIG_IPV6_SCTP__ y
fi
dep_tristate ' The SCTP Protocol (EXPERIMENTAL)' CONFIG_IP_SCTP $CONFIG_IPV6_SCTP__
if [ "$CONFIG_IP_SCTP" != "n" ]; then
bool ' SCTP: Use old checksum (Adler-32)' CONFIG_SCTP_ADLER32
bool ' SCTP: Debug messages' CONFIG_SCTP_DBG_MSG
bool ' SCTP: Debug object counts' CONFIG_SCTP_DBG_OBJCNT
fi
endmenu
#
# Makefile for SCTP support code.
#
obj-$(CONFIG_IP_SCTP) += sctp.o
obj-y := sctp_sm_statetable.o sctp_sm_statefuns.o sctp_sm_sideeffect.o \
sctp_protocol.o sctp_endpointola.o sctp_associola.o \
sctp_transport.o sctp_sm_make_chunk.o sctp_ulpevent.o \
sctp_inqueue.o sctp_outqueue.o sctp_ulpqueue.o sctp_command.o \
sctp_tsnmap.o sctp_bind_addr.o sctp_socket.o sctp_primitive.o \
sctp_output.o sctp_input.o sctp_hashdriver.o sctp_sla1.o \
sctp_debug.o
ifeq ($(CONFIG_SCTP_ADLER32), y)
obj-y += sctp_adler32.o
else
obj-y += sctp_crc32c.o
endif
obj-$(CONFIG_SCTP_DBG_OBJCNT) += sctp_objcnt.o
obj-$(CONFIG_SYSCTL) += sctp_sysctl.o
obj-$(subst m,y,$(CONFIG_IPV6)) += sctp_ipv6.o
sctp-objs := $(obj-y)
include $(TOPDIR)/Rules.make
/* SCTP kernel reference Implementation
* Copyright (c) 1999-2000 Cisco, Inc.
* Copyright (c) 1999-2001 Motorola, Inc.
*
* This file is part of the SCTP kernel reference Implementation
*
* $Header: /cvsroot/lksctp/lksctp/sctp_cvs/net/sctp/sctp_adler32.c,v 1.5 2002/06/13 16:03:38 jgrimm Exp $
*
* This file has direct heritage from the SCTP user-level reference
* implementation by R. Stewart, et al. These functions implement the
* Adler-32 algorithm as specified by RFC 2960.
*
* The SCTP reference implementation is free software;
* you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* The SCTP reference implementation is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* ************************
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU CC; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Please send any bug reports or fixes you make to the
* email address(es):
* lksctp developers <lksctp-developers@lists.sourceforge.net>
*
* Or submit a bug report through the following website:
* http://www.sf.net/projects/lksctp
*
* Written or modified by:
* Randall Stewart <rstewar1@email.mot.com>
* Ken Morneau <kmorneau@cisco.com>
* Qiaobing Xie <qxie1@email.mot.com>
*
* Any bugs reported given to us we will try to fix... any fixes shared will
* be incorporated into the next SCTP release.
*/
static char *cvs_id __attribute__ ((unused)) = "$Id: sctp_adler32.c,v 1.5 2002/06/13 16:03:38 jgrimm Exp $";
/* This is an entry point for external calls
* Define this function in the header file. This is
* direct from rfc1950, ...
* The following C code computes the Adler-32 checksum of a data buffer.
It is written for clarity, not for speed. The sample code is in the
ANSI C programming language. Non C users may find it easier to read
with these hints:
& Bitwise AND operator.
>> Bitwise right shift operator. When applied to an
unsigned quantity, as here, right shift inserts zero bit(s)
at the left.
<< Bitwise left shift operator. Left shift inserts zero
bit(s) at the right.
++ "n++" increments the variable n.
% modulo operator: a % b is the remainder of a divided by b.
* Well, the above is a bit of a lie, I have optimized this a small
* tad, but I have commented the original lines below
*/
#include <linux/types.h>
#include <net/sctp/sctp.h>
#define BASE 65521 /* largest prime smaller than 65536 */
/* Performance work as shown this pig to be the
* worst CPU wise guy. I have done what I could think
* of on my flight to Austrialia but I am sure some
* clever assembly could speed this up, but of
* course this would require the dreaded #ifdef's for
* architecture. If you can speed this up more, pass
* it back and we will incorporate it :-)
*/
unsigned long update_adler32(unsigned long adler,
unsigned char *buf, int len)
{
uint32_t s1 = adler & 0xffff;
uint32_t s2 = (adler >> 16) & 0xffff;
int n;
for (n = 0; n < len; n++,buf++) {
/* s1 = (s1 + buf[n]) % BASE */
/* first we add */
s1 = (s1 + *buf);
/* Now if we need to, we do a mod by
* subtracting. It seems a bit faster
* since I really will only ever do
* one subtract at the MOST, since buf[n]
* is a max of 255.
*/
if(s1 >= BASE){
s1 -= BASE;
}
/* s2 = (s2 + s1) % BASE */
/* first we add */
s2 = (s2 + s1);
/* again, it is more efficent (it seems) to
* subtract since the most s2 will ever be
* is (BASE-1 + BASE-1) in the worse case.
* This would then be (2 * BASE) - 2, which
* will still only do one subtract. On Intel
* this is much better to do this way and
* avoid the divide. Have not -pg'd on
* sparc.
*/
if(s2 >= BASE){
/* s2 %= BASE;*/
s2 -= BASE;
}
}
/* Return the adler32 of the bytes buf[0..len-1] */
return (s2 << 16) + s1;
}
uint32_t
count_crc(uint8_t *ptr,
uint16_t count)
{
/*
* Update a running Adler-32 checksum with the bytes
* buf[0..len-1] and return the updated checksum. The Adler-32
* checksum should be initialized to 1.
*/
uint32_t adler = 1L;
uint32_t zero = 0L;
/* Calculate the CRC up to the checksum field. */
adler = update_adler32(adler, ptr,
sizeof(struct sctphdr) - sizeof(uint32_t));
/* Skip over the checksum field. */
adler = update_adler32(adler, &zero, sizeof(uint32_t));
ptr += sizeof(struct sctphdr);
count -= sizeof(struct sctphdr);
/* Calculate the rest of the Adler-32. */
adler = update_adler32(adler, ptr, count);
return(adler);
}
This diff is collapsed.
This diff is collapsed.
/* SCTP kernel reference Implementation Copyright (C) 1999-2001
* Cisco, Motorola, and IBM
* Copyright 2001 La Monte H.P. Yarroll
*
* This file is part of the SCTP kernel reference Implementation
*
* $Header: /cvsroot/lksctp/lksctp/sctp_cvs/net/sctp/sctp_command.c,v 1.4 2002/04/24 16:33:39 jgrimm Exp $
*
* These functions manipulate sctp command sequences.
*
* The SCTP reference implementation is free software;
* you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* The SCTP reference implementation is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* ************************
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU CC; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Please send any bug reports or fixes you make to the
* email address(es):
* lksctp developers <lksctp-developers@lists.sourceforge.net>
*
* Or submit a bug report through the following website:
* http://www.sf.net/projects/lksctp
*
* Written or modified by:
* La Monte H.P. Yarroll <piggy@acm.org>
* Karl Knutson <karl@athena.chicago.il.us>
*
* Any bugs reported given to us we will try to fix... any fixes shared will
* be incorporated into the next SCTP release.
*/
static char *cvs_id __attribute__ ((unused)) = "$Id: sctp_command.c,v 1.4 2002/04/24 16:33:39 jgrimm Exp $";
#include <linux/config.h>
#include <linux/types.h>
#include <net/sctp/sctp.h>
#include <net/sctp/sctp_sm.h>
/* Create a new sctp_command_sequence. */
sctp_cmd_seq_t *
sctp_new_cmd_seq(int priority)
{
sctp_cmd_seq_t *retval;
retval = t_new(sctp_cmd_seq_t, priority);
sctp_init_cmd_seq(retval);
return retval;
} /* sctp_new_cmd_seq() */
/* Initialize a block of memory as a command sequence. */
int
sctp_init_cmd_seq(sctp_cmd_seq_t *seq)
{
memset(seq, 0, sizeof(sctp_cmd_seq_t));
return 1; /* We always succeed. */
} /* sctp_init_cmd_seq() */
/* Add a command to a sctp_cmd_seq_t.
* Return 0 if the command sequence is full.
*/
int
sctp_add_cmd(sctp_cmd_seq_t *seq, sctp_verb_t verb, sctp_arg_t obj)
{
if (seq->next_free_slot >= SCTP_MAX_NUM_COMMANDS) {
goto fail;
}
seq->cmds[seq->next_free_slot].verb = verb;
seq->cmds[seq->next_free_slot++].obj = obj;
return 1;
fail:
return 0;
} /* sctp_add_cmd() */
/* Rewind an sctp_cmd_seq_t to iterate from the start. */
int
sctp_rewind_sequence(sctp_cmd_seq_t *seq)
{
seq->next_cmd = 0;
return 1; /* We always succeed. */
} /* sctp_rewind_sequence() */
/* Return the next command structure in a sctp_cmd_seq.
* Returns NULL at the end of the sequence.
*/
sctp_cmd_t *
sctp_next_cmd(sctp_cmd_seq_t *seq)
{
sctp_cmd_t *retval = NULL;
if (seq->next_cmd < seq->next_free_slot) {
retval = &seq->cmds[seq->next_cmd++];
}
return retval;
} /* sctp_next_cmd() */
/* Dispose of a command sequence. */
void
sctp_free_cmd_seq(sctp_cmd_seq_t *seq)
{
kfree(seq);
} /* sctp_free_cmd_seq() */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -355,7 +355,7 @@ static struct dentry_operations sockfs_dentry_operations = { ...@@ -355,7 +355,7 @@ static struct dentry_operations sockfs_dentry_operations = {
* but we take care of internal coherence yet. * but we take care of internal coherence yet.
*/ */
static int sock_map_fd(struct socket *sock) int sock_map_fd(struct socket *sock)
{ {
int fd; int fd;
struct qstr this; struct qstr this;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment