lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080916165205.GK8702@ghostprotocols.net>
Date:	Tue, 16 Sep 2008 13:52:05 -0300
From:	Arnaldo Carvalho de Melo <acme@...hat.com>
To:	Rémi Denis-Courmont 
	<remi.denis-courmont@...ia.com>
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH 08/14] Phonet: receive path socket lookup

Em Tue, Sep 16, 2008 at 06:08:08PM +0300, Rémi Denis-Courmont escreveu:
> This delivers received packet to the right socket, if any.
> 
> Signed-off-by: Remi Denis-Courmont <remi.denis-courmont@...ia.com>
> ---
>  include/net/phonet/phonet.h |    1 +
>  net/phonet/af_phonet.c      |   13 ++++++++++++-
>  2 files changed, 13 insertions(+), 1 deletions(-)
> 
> diff --git a/include/net/phonet/phonet.h b/include/net/phonet/phonet.h
> index e0fa080..8e7e42d 100644
> --- a/include/net/phonet/phonet.h
> +++ b/include/net/phonet/phonet.h
> @@ -35,6 +35,7 @@
>   */
>  struct pn_sock {
>  	struct sock	sk;
> +	int		(*handler)(struct sock *, struct sk_buff *);
>  	u16		sobject;
>  	u8		resource;
>  };
> diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c
> index 12c72e1..317f30c 100644
> --- a/net/phonet/af_phonet.c
> +++ b/net/phonet/af_phonet.c
> @@ -96,7 +96,9 @@ static int phonet_rcv(struct sk_buff *skb, struct net_device *dev,
>  			struct net_device *orig_dev)
>  {
>  	struct phonethdr *ph;
> +	struct sock *sk;
>  	struct sockaddr_pn sa;
> +	int err;
>  	u16 len;
>  
>  	if (dev_net(dev) != &init_net)
> @@ -120,7 +122,15 @@ static int phonet_rcv(struct sk_buff *skb, struct net_device *dev,
>  	if (pn_sockaddr_get_addr(&sa) == 0)
>  		goto out; /* currently, we cannot be device 0 */
>  
> -	/* TODO: put packets to sockets backlog */
> +	sk = pn_find_sock_by_sa(&sa);
> +	if (sk == NULL)
> +		goto out;
> +
> +	/* Push data to the socket (or other sockets connected to it). */
> +	err = pn_sk(sk)->handler(sk, skb);

wouldn't be nice to use sk_backlog_rcv() and sk_receive_skb()?

> +	sock_put(sk);
> +
> +	return err ? NET_RX_DROP : NET_RX_SUCCESS;
>  
>  out:
>  	kfree_skb(skb);
> @@ -196,6 +206,7 @@ static int __init phonet_init(void)
>  {
>  	int err;
>  
> +	phonet_socket_init();
>  	err = sock_register(&phonet_proto_family);
>  	if (err) {
>  		printk(KERN_ALERT
> -- 
> 1.5.4.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ