diff -ur linux/include/net/x25.h linux-x25/include/net/x25.h
--- linux/include/net/x25.h	Tue Oct  6 02:33:35 1998
+++ linux-x25/include/net/x25.h	Sat Feb 26 16:51:39 2000
@@ -153,7 +153,7 @@
 
 /* x25_dev.c */
 extern void x25_send_frame(struct sk_buff *, struct x25_neigh *);
-extern int  x25_lapb_receive_frame(struct sk_buff *, struct device *, struct packet_type *);
+extern int  x25_dev_receive_frame(struct sk_buff *, struct device *, struct packet_type *);
 extern int  x25_llc_receive_frame(struct sk_buff *, struct device *, struct packet_type *);
 extern void x25_establish_link(struct x25_neigh *);
 extern void x25_terminate_link(struct x25_neigh *);
diff -ur linux/net/x25/af_x25.c linux-x25/net/x25/af_x25.c
--- linux/net/x25/af_x25.c	Fri Aug 28 04:33:09 1998
+++ linux-x25/net/x25/af_x25.c	Sat Feb 26 16:51:39 2000
@@ -16,6 +16,7 @@
  *	X.25 001	Jonathan Naylor	Started coding.
  *	X.25 002	Jonathan Naylor	Centralised disconnect handling.
  *					New timer architecture.
+ *	2000-02-24	Henner Eisen	Loopback device support.
  */
 
 #include <linux/config.h>
@@ -190,6 +191,7 @@
 #if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE)
 	 || dev->type == ARPHRD_ETHER
 #endif
+	 || dev->type == ARPHRD_LOOPBACK
 	 ) {
 		switch (event) {
 			case NETDEV_UP:
@@ -1265,7 +1267,7 @@
 {
 	0,		/* MUTTER ntohs(ETH_P_X25),*/
 	0,		/* copy */
-	x25_lapb_receive_frame,
+	x25_dev_receive_frame,
 	NULL,
 	NULL,
 };
@@ -1341,6 +1343,7 @@
 #if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE)
 					   || dev->type == ARPHRD_ETHER
 #endif
+					   || dev->type == ARPHRD_LOOPBACK
 									))
 		x25_link_device_up(dev);
 	
diff -ur linux/net/x25/x25_dev.c linux-x25/net/x25/x25_dev.c
--- linux/net/x25/x25_dev.c	Mon Jul 27 08:35:58 1998
+++ linux-x25/net/x25/x25_dev.c	Sat Feb 26 16:51:39 2000
@@ -14,6 +14,7 @@
  *
  *	History
  *	X.25 001	Jonathan Naylor	Started coding.
+ *	2000-02-26	Henner Eisen	Loopback device support.
  */
 
 #include <linux/config.h>
@@ -70,6 +71,8 @@
 		return 0;
 	}
 
+	if(skb->dev->type == ARPHRD_LOOPBACK) lci = 0xfff-lci;
+
 	/*
 	 *	Find an existing socket.
 	 */
@@ -95,10 +98,14 @@
 	return 0;
 }
 
-int x25_lapb_receive_frame(struct sk_buff *skb, struct device *dev, struct packet_type *ptype)
+/*
+ * Receive X.25 packets directly from a network device. This was formerly
+ * named x25_lapb_receive_frame before loopback device support was added.
+ */
+int x25_dev_receive_frame(struct sk_buff *skb, struct device *dev, struct packet_type *ptype)
 {
 	struct x25_neigh *neigh;
-	int queued;
+	int queued, first_byte;
 
 	skb->sk = NULL;
 
@@ -111,9 +118,22 @@
 		return 0;
 	}
 
-	switch (skb->data[0]) {
-		case 0x00:
+	switch (dev->type) {
+		case ARPHRD_LOOPBACK:
+			first_byte = 0; /* data */
+			break;
+		case ARPHRD_X25:
+			first_byte = skb->data[0];
 			skb_pull(skb, 1);
+			break;
+		default:
+			printk(KERN_DEBUG "X.25: packet received from %s, device type unsupported\n", dev->name);
+			kfree_skb(skb);
+			return 0;
+	}
+
+	switch (first_byte) {
+		case 0x00:
 			queued = x25_receive_data(skb, neigh);
 			if( ! queued )
 				/* We need to free the skb ourselves because
@@ -174,7 +194,9 @@
 			ptr  = skb_put(skb, 1);
 			*ptr = 0x01;
 			break;
-
+		case ARPHRD_LOOPBACK:
+			x25_link_established(neigh);
+			return;
 #if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE)
 		case ARPHRD_ETHER:
 			return;
@@ -204,6 +226,10 @@
 			*ptr = 0x02;
 			break;
 
+		case ARPHRD_LOOPBACK:
+			x25_link_terminated(neigh);
+			return;
+
 #if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE)
 		case ARPHRD_ETHER:
 			return;
@@ -228,6 +254,10 @@
 		case ARPHRD_X25:
 			dptr  = skb_push(skb, 1);
 			*dptr = 0x00;
+			break;
+
+		case ARPHRD_LOOPBACK:
+			neigh->dev->hard_header(skb,neigh->dev,ETH_P_X25,NULL,NULL,skb->len);
 			break;
 
 #if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE)
diff -ur linux/net/x25/x25_route.c linux-x25/net/x25/x25_route.c
--- linux/net/x25/x25_route.c	Mon Jul  7 17:20:00 1997
+++ linux-x25/net/x25/x25_route.c	Sat Feb 26 16:51:39 2000
@@ -14,6 +14,7 @@
  *
  *	History
  *	X.25 001	Jonathan Naylor	Started coding.
+ *	2000-02-26	Henner Eisen	Loopback device support.
  */
 
 #include <linux/config.h>
@@ -149,6 +150,7 @@
 #if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE)
 	   || dev->type == ARPHRD_ETHER
 #endif
+	   || dev->type == ARPHRD_LOOPBACK
 	   ))
 		return dev;
 
