All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: linux-can@vger.kernel.org
Cc: Oliver Hartkopp <socketcan@hartkopp.net>
Subject: [PATCH v8 1/7] can: preserve skbuff protocol in can_put_echo_skb
Date: Fri, 28 Feb 2014 14:19:03 +0100	[thread overview]
Message-ID: <1393593549-23072-2-git-send-email-socketcan@hartkopp.net> (raw)
In-Reply-To: <1393593549-23072-1-git-send-email-socketcan@hartkopp.net>

The skbuff protocol value was formerly fixed/sanitized to ETH_P_CAN in
can_put_echo_skb(). With CAN FD this value has to be preserved.
This patch changes the hard assignment of the protocol value to a check of
valid protocol values for CAN and CAN FD.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
---
 drivers/net/can/dev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index c0563f1..e1a3741 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -317,7 +317,9 @@ void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
 	BUG_ON(idx >= priv->echo_skb_max);
 
 	/* check flag whether this packet has to be looped back */
-	if (!(dev->flags & IFF_ECHO) || skb->pkt_type != PACKET_LOOPBACK) {
+	if (!(dev->flags & IFF_ECHO) || skb->pkt_type != PACKET_LOOPBACK ||
+	    (skb->protocol != htons(ETH_P_CAN) &&
+	     skb->protocol != htons(ETH_P_CANFD))) {
 		kfree_skb(skb);
 		return;
 	}
@@ -329,7 +331,6 @@ void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
 			return;
 
 		/* make settings for echo to reduce code in irq context */
-		skb->protocol = htons(ETH_P_CAN);
 		skb->pkt_type = PACKET_BROADCAST;
 		skb->ip_summed = CHECKSUM_UNNECESSARY;
 		skb->dev = dev;
-- 
1.9.0


  reply	other threads:[~2014-02-28 13:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-28 13:19 [PATCH v8 0/7] Add CAN FD infrastructure for CAN driver Oliver Hartkopp
2014-02-28 13:19 ` Oliver Hartkopp [this message]
2014-02-28 13:19 ` [PATCH v8 2/7] can: only send bitrate data via netlink when available Oliver Hartkopp
2014-02-28 13:19 ` [PATCH v8 3/7] can: move sanity check for bitrate and tq into can_get_bittiming Oliver Hartkopp
2014-02-28 13:19 ` [PATCH v8 4/7] can: provide a separate bittiming_const parameter to bittiming functions Oliver Hartkopp
2014-02-28 15:15   ` Oliver Hartkopp
2014-02-28 15:16     ` Marc Kleine-Budde
2014-02-28 13:19 ` [PATCH v8 5/7] can: introduce the data bitrate configuration for CAN FD Oliver Hartkopp
2014-02-28 13:19 ` [PATCH v8 6/7] can: allow to change the device mtu for CAN FD capable devices Oliver Hartkopp
2014-02-28 13:19 ` [PATCH v8 7/7] can: add bittiming check at interface open for CAN FD Oliver Hartkopp
2014-02-28 15:18 ` [PATCH v8 0/7] Add CAN FD infrastructure for CAN driver Stephane Grosjean

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=1393593549-23072-2-git-send-email-socketcan@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=linux-can@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.