All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/6]NET:AX25:ROSE Fixes to rose_header
@ 2016-07-16  9:44 Richard Stearn
  0 siblings, 0 replies; only message in thread
From: Richard Stearn @ 2016-07-16  9:44 UTC (permalink / raw)
  To: netdev, linux-hams

Subject: [PATCH 4/6]NET:AX25:ROSE Fixes to rose_header
Adds comments on the header fields. Removes address copy.

Added comments detailing the ROSE header fields being built.
Removes an address copy that is irrelevant for this ROSE header as there are no
addresses in the header and the copy corrupts the data field of the packet.

Signed-off-by: Richard Stearn <richard@rns-stearn.demon.co.uk>
---
 net/rose/rose_dev.c |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

There are no hardware address fields in the packet. The memcpy corrupts the
packet data.

diff --git a/net/rose/rose_dev.c b/net/rose/rose_dev.c
index 369ca81..44eca10 100644
--- a/net/rose/rose_dev.c
+++ b/net/rose/rose_dev.c
@@ -41,14 +41,11 @@ static int rose_header(struct sk_buff *skb, struct net_device *dev,
 {
 	unsigned char *buff = skb_push(skb, ROSE_MIN_LEN + 2);
 
-	if (daddr)
-		memcpy(buff + 7, daddr, dev->addr_len);
-
-	*buff++ = ROSE_GFI | ROSE_Q_BIT;
-	*buff++ = 0x00;
-	*buff++ = ROSE_DATA;
-	*buff++ = 0x7F;
-	*buff++ = AX25_P_IP;
+	*buff++ = ROSE_GFI | ROSE_Q_BIT; /* GFI and upper 4 bits of the LCI */
+	*buff++ = 0x00;			 /* lower 8 bits of the LCI */
+	*buff++ = ROSE_DATA;		 /* P(S), M, P(R) and data flag */
+	*buff++ = 0x7F;			 /* magic marker */
+	*buff++ = AX25_P_IP;		 /* this is an IP packet */
 
 	if (daddr != NULL)
 		return 37;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-07-16  9:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-16  9:44 [PATCH 4/6]NET:AX25:ROSE Fixes to rose_header Richard Stearn

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.