From: Hagen Paul Pfeifer <hagen@jauu.net>
To: stefani@seibold.net
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH] UDPCP Communication Protocol
Date: Tue, 11 Jan 2011 01:49:26 +0100 [thread overview]
Message-ID: <20110111004926.GA1604@nuttenaction> (raw)
In-Reply-To: <1293787785-3834-1-git-send-email-stefani@seibold.net>
find_dest() via new_dest() may return NULL
* stefani@seibold.net | 2010-12-31 10:29:45 [+0100]:
>+static int udpcp_sendmsg(struct kiocb *iocb, struct sock *sk,
>+ struct msghdr *msg, size_t len)
>+{
>+ struct inet_sock *inet = inet_sk(sk);
>+ struct udpcp_sock *usk = udpcp_sk(sk);
>+ struct ipcm_cookie *ipc;
>+ struct rtable *rt = NULL;
>+ int free = 0;
>+ int connected = 0;
>+ __be32 daddr, faddr, saddr;
>+ __be16 dport;
>+ u8 tos;
>+ int err = 0;
>+ int corkreq = usk->udpsock.corkflag || msg->msg_flags & MSG_MORE;
>+ int (*getfrag) (void *, char *, int, int, int, struct sk_buff *);
>+ struct udpcp_dest *dest;
>+
>+ if (len > UDPCP_MAX_MSGSIZE)
>+ return -EMSGSIZE;
>+
>+ /*
>+ * Check the flags.
>+ */
>+ if (msg->msg_flags & MSG_OOB)
>+ return -EOPNOTSUPP;
>+
>+ /*
>+ * check if socket is binded to a port
>+ */
>+ if (!(sk->sk_userlocks & SOCK_BINDPORT_LOCK) || !inet->inet_num)
>+ return -ENOTCONN;
>+
>+ /*
>+ * Get and verify the address.
>+ */
>+ if (msg->msg_name) {
>+ struct sockaddr_in *usin = (struct sockaddr_in *)msg->msg_name;
>+ if (msg->msg_namelen < sizeof(*usin))
>+ return -EINVAL;
>+ if (usin->sin_family != AF_INET) {
>+ if (usin->sin_family != AF_UNSPEC)
>+ return -EAFNOSUPPORT;
>+ }
>+
>+ daddr = usin->sin_addr.s_addr;
>+ dport = usin->sin_port;
>+ } else {
>+ if (sk->sk_state != TCP_ESTABLISHED)
>+ return -EDESTADDRREQ;
>+ daddr = inet->inet_daddr;
>+ dport = inet->inet_dport;
>+ /* Open fast path for connected socket.
>+ Route will not be used, if at least one option is set.
>+ */
>+ connected = 1;
>+ }
>+
>+ if (dport == 0)
>+ return -EINVAL;
>+
>+ dest = find_dest(sk, daddr, dport);
if (!dest)
return -ENOBUFS;
prev parent reply other threads:[~2011-01-11 0:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-31 9:29 [PATCH] UDPCP Communication Protocol stefani
2010-12-31 10:00 ` Eric Dumazet
2010-12-31 10:22 ` Stefani Seibold
2010-12-31 10:41 ` Eric Dumazet
2010-12-31 11:23 ` Stefani Seibold
2010-12-31 11:54 ` Eric Dumazet
2011-01-01 21:40 ` Stefani Seibold
2011-01-10 22:28 ` Hagen Paul Pfeifer
2010-12-31 10:15 ` Eric Dumazet
2010-12-31 10:29 ` Stefani Seibold
2010-12-31 10:35 ` Eric Dumazet
2010-12-31 11:25 ` Eric Dumazet
2010-12-31 12:00 ` Eric Dumazet
2011-01-01 21:28 ` Stefani Seibold
2010-12-31 17:46 ` Stephen Hemminger
2010-12-31 17:46 ` Stephen Hemminger
2011-01-06 20:11 ` Pavel Machek
2011-01-06 20:17 ` David Miller
2011-01-10 22:53 ` Jesper Juhl
2011-01-11 0:49 ` Hagen Paul Pfeifer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110111004926.GA1604@nuttenaction \
--to=hagen@jauu.net \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stefani@seibold.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).