All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: netdev@vger.kernel.org
Subject: Transforming code to using ICMP packet accessors
Date: Thu, 26 Apr 2007 12:23:39 +0100	[thread overview]
Message-ID: <11959.1177586619@redhat.com> (raw)


How do I convert:

	addr = *(__be32 *)(skb->nh.raw + serr->addr_offset);

to use the ICMP accessor macros now that skb->nh is no longer available?  I
was using this to pluck an address out of the ICMP packet payload, but 

	void rxrpc_UDP_error_report(struct sock *sk)
	{
		struct sock_exterr_skb *serr;
	...
		struct sk_buff *skb;
		__be32 addr;
		__be16 port;
	...

		skb = skb_dequeue(&sk->sk_error_queue);
		if (!skb) {
			_leave("UDP socket errqueue empty");
			return;
		}
	...

		serr = SKB_EXT_ERR(skb);
		addr = *(__be32 *)(skb->nh.raw + serr->addr_offset);
		port = serr->port;

		_net("Rx UDP Error from "NIPQUAD_FMT":%hu",
		     NIPQUAD(addr), ntohs(port));
	...
	}

Should I do this?:

	addr = *(__be32 *)(skb_network_header(skb) + serr->addr_offset);

David

             reply	other threads:[~2007-04-26 11:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-26 11:23 David Howells [this message]
2007-04-26 12:18 ` Transforming code to using ICMP packet accessors Arnaldo Carvalho de Melo
2007-04-26 12:41   ` David Howells

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=11959.1177586619@redhat.com \
    --to=dhowells@redhat.com \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.