patch-2.4.18 linux/net/rose/rose_link.c

Next file: linux/net/rose/rose_subr.c
Previous file: linux/net/rose/af_rose.c
Back to the patch index
Back to the overall index

diff -Naur -X /home/marcelo/lib/dontdiff linux.orig/net/rose/rose_link.c linux/net/rose/rose_link.c
@@ -264,15 +264,21 @@
 	struct sk_buff *skb;
 	unsigned char *dptr;
 	int len;
+	struct net_device *first;
+	int faclen = 0;
 
 	len = AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + ROSE_MIN_LEN + 3;
 
-	if ((skb = alloc_skb(len, GFP_ATOMIC)) == NULL)
+	first = rose_dev_first();
+	if (first)
+		faclen = 6 + AX25_ADDR_LEN + 3 + ROSE_ADDR_LEN;
+	
+	if ((skb = alloc_skb(len + faclen, GFP_ATOMIC)) == NULL)
 		return;
 
 	skb_reserve(skb, AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN);
 
-	dptr = skb_put(skb, ROSE_MIN_LEN + 3);
+	dptr = skb_put(skb, ROSE_MIN_LEN + 3 + faclen);
 
 	*dptr++ = AX25_P_ROSE;
 	*dptr++ = ((lci >> 8) & 0x0F) | ROSE_GFI;
@@ -280,6 +286,21 @@
 	*dptr++ = ROSE_CLEAR_REQUEST;
 	*dptr++ = cause;
 	*dptr++ = diagnostic;
+
+	if (first) {	
+		*dptr++ = 0x00;		/* Address length */
+		*dptr++ = 4 + AX25_ADDR_LEN + 3 + ROSE_ADDR_LEN; /* Facilities length */
+		*dptr++ = 0;
+		*dptr++ = FAC_NATIONAL;
+		*dptr++ = FAC_NATIONAL_FAIL_CALL;
+		*dptr++ = AX25_ADDR_LEN;
+		memcpy(dptr, &rose_callsign, AX25_ADDR_LEN);
+		dptr += AX25_ADDR_LEN;
+		*dptr++ = FAC_NATIONAL_FAIL_ADD;
+		*dptr++ = ROSE_ADDR_LEN + 1;
+		*dptr++ = ROSE_ADDR_LEN * 2;
+		memcpy(dptr, first->dev_addr, ROSE_ADDR_LEN);
+	}
 
 	if (!rose_send_frame(skb, neigh))
 		kfree_skb(skb);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)