Commit 35650676 authored by David S. Miller's avatar David S. Miller

net/sctp/sctp_socket.c: Fix sctp_get_port types, static private funcs.

parent 403307c4
...@@ -123,7 +123,6 @@ extern int sctp_copy_local_addr_list(sctp_protocol_t *, sctp_bind_addr_t *, ...@@ -123,7 +123,6 @@ extern int sctp_copy_local_addr_list(sctp_protocol_t *, sctp_bind_addr_t *,
*/ */
extern int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb); extern int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb);
extern int sctp_inet_listen(struct socket *sock, int backlog); extern int sctp_inet_listen(struct socket *sock, int backlog);
extern long sctp_get_port(struct sock *sk, unsigned short snum);
extern void sctp_write_space(struct sock *sk); extern void sctp_write_space(struct sock *sk);
extern unsigned int sctp_poll(struct file *file, struct socket *sock, extern unsigned int sctp_poll(struct file *file, struct socket *sock,
poll_table *wait); poll_table *wait);
......
...@@ -1534,9 +1534,6 @@ typedef struct sctp_cmsgs { ...@@ -1534,9 +1534,6 @@ typedef struct sctp_cmsgs {
struct sctp_sndrcvinfo *info; struct sctp_sndrcvinfo *info;
} sctp_cmsgs_t; } sctp_cmsgs_t;
int sctp_msghdr_parse(const struct msghdr *msg, sctp_cmsgs_t *cmsgs);
/* Structure for tracking memory objects */ /* Structure for tracking memory objects */
typedef struct { typedef struct {
char *label; char *label;
......
...@@ -136,6 +136,8 @@ int sctp_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) ...@@ -136,6 +136,8 @@ int sctp_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
return retval; return retval;
} }
static long sctp_get_port_local(struct sock *, unsigned short);
/* Bind a local address either to an endpoint or to an association. */ /* Bind a local address either to an endpoint or to an association. */
static int sctp_do_bind(struct sock *sk, sockaddr_storage_t *newaddr, int addr_len) static int sctp_do_bind(struct sock *sk, sockaddr_storage_t *newaddr, int addr_len)
{ {
...@@ -223,10 +225,10 @@ static int sctp_do_bind(struct sock *sk, sockaddr_storage_t *newaddr, int addr_l ...@@ -223,10 +225,10 @@ static int sctp_do_bind(struct sock *sk, sockaddr_storage_t *newaddr, int addr_l
sctp_sk_addr_set(sk, &tmpaddr, &saveaddr); sctp_sk_addr_set(sk, &tmpaddr, &saveaddr);
/* Make sure we are allowed to bind here. /* Make sure we are allowed to bind here.
* The function sctp_get_port() does duplicate address * The function sctp_get_port_local() does duplicate address
* detection. * detection.
*/ */
if ((ret = sctp_get_port(sk, *snum))) { if ((ret = sctp_get_port_local(sk, *snum))) {
sctp_sk_addr_restore(sk, &saveaddr); sctp_sk_addr_restore(sk, &saveaddr);
if (ret == (long) sk) { if (ret == (long) sk) {
/* This endpoint has a conflicting address. */ /* This endpoint has a conflicting address. */
...@@ -665,7 +667,7 @@ static int sctp_setsockopt_bindx(struct sock* sk, struct sockaddr_storage *addrs ...@@ -665,7 +667,7 @@ static int sctp_setsockopt_bindx(struct sock* sk, struct sockaddr_storage *addrs
* If sd in the close() call is a branched-off socket representing only * If sd in the close() call is a branched-off socket representing only
* one association, the shutdown is performed on that association only. * one association, the shutdown is performed on that association only.
*/ */
void sctp_close(struct sock *sk, long timeout) static void sctp_close(struct sock *sk, long timeout)
{ {
sctp_endpoint_t *ep; sctp_endpoint_t *ep;
sctp_association_t *asoc; sctp_association_t *asoc;
...@@ -733,7 +735,9 @@ void sctp_close(struct sock *sk, long timeout) ...@@ -733,7 +735,9 @@ void sctp_close(struct sock *sk, long timeout)
/* BUG: We do not implement timeouts. */ /* BUG: We do not implement timeouts. */
/* BUG: We do not implement the equivalent of wait_for_tcp_memory(). */ /* BUG: We do not implement the equivalent of wait_for_tcp_memory(). */
int sctp_sendmsg(struct sock *sk, struct msghdr *msg, int size) static int sctp_msghdr_parse(const struct msghdr *, sctp_cmsgs_t *);
static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, int size)
{ {
sctp_opt_t *sp; sctp_opt_t *sp;
sctp_endpoint_t *ep; sctp_endpoint_t *ep;
...@@ -1097,8 +1101,8 @@ int sctp_sendmsg(struct sock *sk, struct msghdr *msg, int size) ...@@ -1097,8 +1101,8 @@ int sctp_sendmsg(struct sock *sk, struct msghdr *msg, int size)
* flags - flags sent or received with the user message, see Section * flags - flags sent or received with the user message, see Section
* 5 for complete description of the flags. * 5 for complete description of the flags.
*/ */
int sctp_recvmsg(struct sock *sk, struct msghdr *msg, int len, int noblock, static int sctp_recvmsg(struct sock *sk, struct msghdr *msg, int len,
int flags, int *addr_len) int noblock, int flags, int *addr_len)
{ {
sctp_ulpevent_t *event = NULL; sctp_ulpevent_t *event = NULL;
struct sk_buff *skb; struct sk_buff *skb;
...@@ -1231,8 +1235,8 @@ static inline int sctp_setsockopt_autoclose(struct sock *sk, char *optval, int o ...@@ -1231,8 +1235,8 @@ static inline int sctp_setsockopt_autoclose(struct sock *sk, char *optval, int o
* optval - the buffer to store the value of the option. * optval - the buffer to store the value of the option.
* optlen - the size of the buffer. * optlen - the size of the buffer.
*/ */
int sctp_setsockopt(struct sock *sk, int level, int optname, char *optval, static int sctp_setsockopt(struct sock *sk, int level, int optname,
int optlen) char *optval, int optlen)
{ {
int retval = 0; int retval = 0;
char * tmp; char * tmp;
...@@ -1315,19 +1319,19 @@ int sctp_setsockopt(struct sock *sk, int level, int optname, char *optval, ...@@ -1315,19 +1319,19 @@ int sctp_setsockopt(struct sock *sk, int level, int optname, char *optval,
} }
/* FIXME: Write comments. */ /* FIXME: Write comments. */
int sctp_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) static int sctp_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
{ {
return -EOPNOTSUPP; /* STUB */ return -EOPNOTSUPP; /* STUB */
} }
/* FIXME: Write comments. */ /* FIXME: Write comments. */
int sctp_disconnect(struct sock *sk, int flags) static int sctp_disconnect(struct sock *sk, int flags)
{ {
return -EOPNOTSUPP; /* STUB */ return -EOPNOTSUPP; /* STUB */
} }
/* FIXME: Write comments. */ /* FIXME: Write comments. */
struct sock *sctp_accept(struct sock *sk, int flags, int *err) static struct sock *sctp_accept(struct sock *sk, int flags, int *err)
{ {
int error = -EOPNOTSUPP; int error = -EOPNOTSUPP;
...@@ -1336,7 +1340,7 @@ struct sock *sctp_accept(struct sock *sk, int flags, int *err) ...@@ -1336,7 +1340,7 @@ struct sock *sctp_accept(struct sock *sk, int flags, int *err)
} }
/* FIXME: Write Comments. */ /* FIXME: Write Comments. */
int sctp_ioctl(struct sock *sk, int cmd, unsigned long arg) static int sctp_ioctl(struct sock *sk, int cmd, unsigned long arg)
{ {
return -EOPNOTSUPP; /* STUB */ return -EOPNOTSUPP; /* STUB */
} }
...@@ -1345,7 +1349,7 @@ int sctp_ioctl(struct sock *sk, int cmd, unsigned long arg) ...@@ -1345,7 +1349,7 @@ int sctp_ioctl(struct sock *sk, int cmd, unsigned long arg)
* initialized the SCTP-specific portion of the sock. * initialized the SCTP-specific portion of the sock.
* The sock structure should already be zero-filled memory. * The sock structure should already be zero-filled memory.
*/ */
int sctp_init_sock(struct sock *sk) static int sctp_init_sock(struct sock *sk)
{ {
sctp_endpoint_t *ep; sctp_endpoint_t *ep;
sctp_protocol_t *proto; sctp_protocol_t *proto;
...@@ -1430,7 +1434,7 @@ int sctp_init_sock(struct sock *sk) ...@@ -1430,7 +1434,7 @@ int sctp_init_sock(struct sock *sk)
} }
/* Cleanup any SCTP per socket resources. */ /* Cleanup any SCTP per socket resources. */
int sctp_destroy_sock(struct sock *sk) static int sctp_destroy_sock(struct sock *sk)
{ {
sctp_endpoint_t *ep; sctp_endpoint_t *ep;
...@@ -1444,7 +1448,7 @@ int sctp_destroy_sock(struct sock *sk) ...@@ -1444,7 +1448,7 @@ int sctp_destroy_sock(struct sock *sk)
} }
/* FIXME: Comments needed. */ /* FIXME: Comments needed. */
void sctp_shutdown(struct sock *sk, int how) static void sctp_shutdown(struct sock *sk, int how)
{ {
/* UDP-style sockets do not support shutdown. */ /* UDP-style sockets do not support shutdown. */
/* STUB */ /* STUB */
...@@ -1565,7 +1569,7 @@ static inline int sctp_getsockopt_autoclose(struct sock *sk, int len, char *optv ...@@ -1565,7 +1569,7 @@ static inline int sctp_getsockopt_autoclose(struct sock *sk, int len, char *optv
} }
/* Helper routine to branch off an association to a new socket. */ /* Helper routine to branch off an association to a new socket. */
int sctp_do_peeloff(sctp_association_t *assoc, struct socket **newsock) static int sctp_do_peeloff(sctp_association_t *assoc, struct socket **newsock)
{ {
struct sock *oldsk = assoc->base.sk; struct sock *oldsk = assoc->base.sk;
struct sock *newsk; struct sock *newsk;
...@@ -1654,8 +1658,8 @@ static inline int sctp_getsockopt_peeloff(struct sock *sk, int len, char *optval ...@@ -1654,8 +1658,8 @@ static inline int sctp_getsockopt_peeloff(struct sock *sk, int len, char *optval
return 0; return 0;
} }
int sctp_getsockopt(struct sock *sk, int level, int optname, char *optval, static int sctp_getsockopt(struct sock *sk, int level, int optname,
int *optlen) char *optval, int *optlen)
{ {
int retval = 0; int retval = 0;
sctp_protocol_t *proto = sctp_get_protocol(); sctp_protocol_t *proto = sctp_get_protocol();
...@@ -1714,12 +1718,12 @@ int sctp_getsockopt(struct sock *sk, int level, int optname, char *optval, ...@@ -1714,12 +1718,12 @@ int sctp_getsockopt(struct sock *sk, int level, int optname, char *optval,
return retval; return retval;
} }
void sctp_hash(struct sock *sk) static void sctp_hash(struct sock *sk)
{ {
/* STUB */ /* STUB */
} }
void sctp_unhash(struct sock *sk) static void sctp_unhash(struct sock *sk)
{ {
/* STUB */ /* STUB */
} }
...@@ -1736,7 +1740,7 @@ void sctp_unhash(struct sock *sk) ...@@ -1736,7 +1740,7 @@ void sctp_unhash(struct sock *sk)
* link to the socket (struct sock) that uses it, the port number and * link to the socket (struct sock) that uses it, the port number and
* a fastreuse flag (FIXME: NPI ipg). * a fastreuse flag (FIXME: NPI ipg).
*/ */
long sctp_get_port(struct sock *sk, unsigned short snum) static long sctp_get_port_local(struct sock *sk, unsigned short snum)
{ {
sctp_bind_hashbucket_t *head; /* hash list */ sctp_bind_hashbucket_t *head; /* hash list */
sctp_bind_bucket_t *pp; /* hash list port iterator */ sctp_bind_bucket_t *pp; /* hash list port iterator */
...@@ -1916,6 +1920,13 @@ long sctp_get_port(struct sock *sk, unsigned short snum) ...@@ -1916,6 +1920,13 @@ long sctp_get_port(struct sock *sk, unsigned short snum)
return ret; return ret;
} }
static int sctp_get_port(struct sock *sk, unsigned short snum)
{
long ret = sctp_get_port_local(sk, snum);
return (ret ? 1 : 0);
}
/* /*
* 3.1.3 listen() - UDP Style Syntax * 3.1.3 listen() - UDP Style Syntax
* *
...@@ -1923,7 +1934,7 @@ long sctp_get_port(struct sock *sk, unsigned short snum) ...@@ -1923,7 +1934,7 @@ long sctp_get_port(struct sock *sk, unsigned short snum)
* An application uses listen() to mark a socket as being able to * An application uses listen() to mark a socket as being able to
* accept new associations. * accept new associations.
*/ */
int sctp_seqpacket_listen(struct sock *sk, int backlog) static int sctp_seqpacket_listen(struct sock *sk, int backlog)
{ {
sctp_opt_t *sp = sctp_sk(sk); sctp_opt_t *sp = sctp_sk(sk);
sctp_endpoint_t *ep = sp->ep; sctp_endpoint_t *ep = sp->ep;
...@@ -2073,7 +2084,7 @@ static sctp_bind_bucket_t *sctp_bucket_create(sctp_bind_hashbucket_t *head, unsi ...@@ -2073,7 +2084,7 @@ static sctp_bind_bucket_t *sctp_bucket_create(sctp_bind_hashbucket_t *head, unsi
} }
/* FIXME: Commments! */ /* FIXME: Commments! */
__inline__ void __sctp_put_port(struct sock *sk) static __inline__ void __sctp_put_port(struct sock *sk)
{ {
sctp_protocol_t *sctp_proto = sctp_get_protocol(); sctp_protocol_t *sctp_proto = sctp_get_protocol();
sctp_bind_hashbucket_t *head = sctp_bind_hashbucket_t *head =
...@@ -2109,7 +2120,7 @@ void sctp_put_port(struct sock *sk) ...@@ -2109,7 +2120,7 @@ void sctp_put_port(struct sock *sk)
* One of those addresses will be the primary address for the association. * One of those addresses will be the primary address for the association.
* This automatically enables the multihoming capability of SCTP. * This automatically enables the multihoming capability of SCTP.
*/ */
int sctp_autobind(struct sock *sk) static int sctp_autobind(struct sock *sk)
{ {
sockaddr_storage_t autoaddr; sockaddr_storage_t autoaddr;
int addr_len = 0; int addr_len = 0;
...@@ -2180,7 +2191,7 @@ int sctp_autobind(struct sock *sk) ...@@ -2180,7 +2191,7 @@ int sctp_autobind(struct sock *sk)
* msg_control * msg_control
* points here * points here
*/ */
int sctp_msghdr_parse(const struct msghdr *msg, sctp_cmsgs_t *cmsgs) static int sctp_msghdr_parse(const struct msghdr *msg, sctp_cmsgs_t *cmsgs)
{ {
struct cmsghdr *cmsg; struct cmsghdr *cmsg;
...@@ -2371,7 +2382,7 @@ static int sctp_wait_for_packet(struct sock * sk, int *err, long *timeo_p) ...@@ -2371,7 +2382,7 @@ static int sctp_wait_for_packet(struct sock * sk, int *err, long *timeo_p)
* Note: This is pretty much the same routine as in core/datagram.c * Note: This is pretty much the same routine as in core/datagram.c
* with a few changes to make lksctp work. * with a few changes to make lksctp work.
*/ */
struct sk_buff *sctp_skb_recv_datagram(struct sock *sk, int flags, int noblock, int *err) static struct sk_buff *sctp_skb_recv_datagram(struct sock *sk, int flags, int noblock, int *err)
{ {
int error; int error;
struct sk_buff *skb; struct sk_buff *skb;
......
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