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]
Date:	Wed, 17 Oct 2012 13:48:57 +0000
From:	"N, Mugunthan V" <mugunthanvnm@...com>
To:	Ben Hutchings <bhutchings@...arflare.com>
CC:	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"davem@...emloft.net" <davem@...emloft.net>,
	Richard Cochran <richardcochran@...il.com>
Subject: RE: [PATCH 4/6] ptp: add api to get ptp seq id and event type from
 skb

> -----Original Message-----
> From: Ben Hutchings [mailto:bhutchings@...arflare.com]
> Sent: Wednesday, October 17, 2012 4:41 AM
> To: N, Mugunthan V
> Cc: netdev@...r.kernel.org; davem@...emloft.net; Richard Cochran
> Subject: Re: [PATCH 4/6] ptp: add api to get ptp seq id and event type
> from skb
> 
> On Wed, 2012-10-17 at 04:15 +0530, Mugunthan V N wrote:
> > Cc: Richard Cochran <richardcochran@...il.com>
> > Signed-off-by: Mugunthan V N <mugunthanvnm@...com>
> > ---
> >  include/linux/ptp_classify.h |   42
> ++++++++++++++++++++++++++++++++++++++++++
> >  1 files changed, 42 insertions(+), 0 deletions(-)
> >
> > diff --git a/include/linux/ptp_classify.h
> b/include/linux/ptp_classify.h
> > index 1dc420b..9b3b55b 100644
> > --- a/include/linux/ptp_classify.h
> > +++ b/include/linux/ptp_classify.h
> > @@ -137,4 +137,46 @@ static inline int ptp_filter_init(struct
> sock_filter *f, int len)
> >  	{OP_RETA,	0,   0, 0			}, /*              */ \
> >  /*L6x*/	{OP_RETK,	0,   0, PTP_CLASS_NONE		},
> >
> > +static inline int ptp_get_skb_event(struct sk_buff *skb, u32
> ptp_class,
> > +				    u16 *evt_seqid, u8 *evt_msgtype)
> > +{
> > +	u16 *seqid;
> > +	unsigned int offset;
> > +	u8 *msgtype, *data = skb->data;
> > +
> > +	switch (ptp_class) {
> > +	case PTP_CLASS_V1_IPV4:
> > +	case PTP_CLASS_V2_IPV4:
> > +		offset = ETH_HLEN + IPV4_HLEN(data) + UDP_HLEN;
> > +		break;
> > +	case PTP_CLASS_V1_IPV6:
> > +	case PTP_CLASS_V2_IPV6:
> > +		offset = OFF_PTP6;
> > +		break;
> > +	case PTP_CLASS_V2_L2:
> > +		offset = ETH_HLEN;
> > +		break;
> > +	case PTP_CLASS_V2_VLAN:
> > +		offset = ETH_HLEN + VLAN_HLEN;
> > +		break;
> > +	default:
> > +		return 0;
> > +	}
> > +
> > +	if (skb->len + ETH_HLEN < offset + OFF_PTP_SEQUENCE_ID +
> sizeof(*seqid))
> > +		return 0;
> > +
> > +	if (unlikely(ptp_class & PTP_CLASS_V1))
> > +		msgtype = data + offset + OFF_PTP_CONTROL;
> > +	else
> > +		msgtype = data + offset;
> > +
> > +	seqid = (u16 *)(data + offset + OFF_PTP_SEQUENCE_ID);
> 
> This assumes the skb is linear.  Use skb_header_pointer() to allow for
> fragmented skbs.

Will fix this in next version patch series

Regards
Mugunthan V N

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ