Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 30411
b: refs/heads/master
c: 51f9cc1
h: refs/heads/master
i:
  30409: c273f11
  30407: 689db44
v: v3
  • Loading branch information
Allan Stephens authored and David S. Miller committed Jun 26, 2006
1 parent 1ee434b commit f1ef3c0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a3b0a5a9d004002a9cf9cf7a9d10cf1447a73d2b
refs/heads/master: 51f9cc1ff8aa0866ff8fb3c06be4c64b5edbb2e8
17 changes: 13 additions & 4 deletions trunk/net/tipc/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,8 @@ static int send_msg(struct kiocb *iocb, struct socket *sock,

if (unlikely(!dest))
return -EDESTADDRREQ;
if (unlikely(dest->family != AF_TIPC))
if (unlikely((m->msg_namelen < sizeof(*dest)) ||
(dest->family != AF_TIPC)))
return -EINVAL;

needs_conn = (sock->state != SS_READY);
Expand Down Expand Up @@ -1245,21 +1246,29 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen,
if (sock->state == SS_READY)
return -EOPNOTSUPP;

/* MOVE THE REST OF THIS ERROR CHECKING TO send_msg()? */
/* Issue Posix-compliant error code if socket is in the wrong state */

if (sock->state == SS_LISTENING)
return -EOPNOTSUPP;
if (sock->state == SS_CONNECTING)
return -EALREADY;
if (sock->state != SS_UNCONNECTED)
return -EISCONN;

if ((destlen < sizeof(*dst)) || (dst->family != AF_TIPC) ||
((dst->addrtype != TIPC_ADDR_NAME) && (dst->addrtype != TIPC_ADDR_ID)))
/*
* Reject connection attempt using multicast address
*
* Note: send_msg() validates the rest of the address fields,
* so there's no need to do it here
*/

if (dst->addrtype == TIPC_ADDR_MCAST)
return -EINVAL;

/* Send a 'SYN-' to destination */

m.msg_name = dest;
m.msg_namelen = destlen;
if ((res = send_msg(NULL, sock, &m, 0)) < 0) {
sock->state = SS_DISCONNECTING;
return res;
Expand Down

0 comments on commit f1ef3c0

Please sign in to comment.