diff -ur pre6-5/include/net/x25.h pre6-5-x25loop/include/net/x25.h
--- pre6-5/include/net/x25.h	Sat Apr 22 09:30:03 2000
+++ pre6-5-x25loop/include/net/x25.h	Sat Apr 22 14:29:50 2000
@@ -158,7 +158,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 net_device *, struct packet_type *);
+extern int  x25_netdev_receive_frame(struct sk_buff *, struct net_device *, struct packet_type *);
 extern int  x25_llc_receive_frame(struct sk_buff *, struct net_device *, struct packet_type *);
 extern void x25_establish_link(struct x25_neigh *);
 extern void x25_terminate_link(struct x25_neigh *);
diff -ur pre6-5/net/x25/af_x25.c pre6-5-x25loop/net/x25/af_x25.c
--- pre6-5/net/x25/af_x25.c	Sat Apr 22 09:30:03 2000
+++ pre6-5-x25loop/net/x25/af_x25.c	Sat Apr 22 14:36:54 2000
@@ -20,6 +20,7 @@
  *	2000-22-03	Daniela Squassoni Allowed disabling/enabling of 
  *					  facilities negotiation and increased 
  *					  the throughput upper limit.
+ *	2000-02-24	Henner Eisen	Loopback device support.
  */
 
 #include <linux/config.h>
@@ -193,6 +194,7 @@
 #if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE)
 	 || dev->type == ARPHRD_ETHER
 #endif
+	 || dev->type == ARPHRD_LOOPBACK
 	 ) {
 		switch (event) {
 			case NETDEV_UP:
@@ -1271,7 +1273,7 @@
 {
 	0,		/* MUTTER ntohs(ETH_P_X25),*/
 	0,		/* copy */
-	x25_lapb_receive_frame,
+	x25_netdev_receive_frame,
 	NULL,
 	NULL,
 };
@@ -1333,6 +1335,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 pre6-5/net/x25/x25_dev.c pre6-5-x25loop/net/x25/x25_dev.c
--- pre6-5/net/x25/x25_dev.c	Sun Sep  5 20:29:02 1999
+++ pre6-5-x25loop/net/x25/x25_dev.c	Sat Apr 22 14:29:50 2000
@@ -14,6 +14,7 @@
  *
  *	History
  *	X.25 001	Jonathan Naylor	Started coding.
+ *      2000-02-24      Henner Eisen    loopback device support.
  */
 
 #include <linux/config.h>
@@ -63,6 +64,8 @@
 		return 0;
 	}
 
+	if(skb->dev->type == ARPHRD_LOOPBACK) lci = 0xfff-lci;
+
 	/*
 	 *	Find an existing socket.
 	 */
@@ -88,7 +91,11 @@
 	return 0;
 }
 
-int x25_lapb_receive_frame(struct sk_buff *skb, struct net_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_netdev_receive_frame(struct sk_buff *skb, struct net_device *dev, struct packet_type *ptype)
 {
 	struct x25_neigh *neigh;
 	int queued;
@@ -104,6 +111,11 @@
 		return 0;
 	}
 
+	if(skb->dev->type == ARPHRD_LOOPBACK){
+		if(! x25_receive_data(skb, neigh)) kfree_skb(skb);
+		return 0;
+	}
+
 	switch (skb->data[0]) {
 		case 0x00:
 			skb_pull(skb, 1);
@@ -130,6 +142,7 @@
 			return 0;
 
 		default:
+		  printk(KERN_DEBUG "unknown first byte: %d\n",(int)skb->data[0]); 
 			kfree_skb(skb);
 			return 0;
 	}
@@ -167,7 +180,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;
@@ -196,7 +211,9 @@
 			ptr  = skb_put(skb, 1);
 			*ptr = 0x02;
 			break;
-
+		case ARPHRD_LOOPBACK:
+			x25_link_terminated(neigh);
+			return;
 #if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE)
 		case ARPHRD_ETHER:
 			return;
@@ -222,7 +239,9 @@
 			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)
 		case ARPHRD_ETHER:
 			kfree_skb(skb);
@@ -240,6 +259,3 @@
 }
 
 #endif
-
-
-
diff -ur pre6-5/net/x25/x25_route.c pre6-5-x25loop/net/x25/x25_route.c
--- pre6-5/net/x25/x25_route.c	Fri Feb 18 17:00:34 2000
+++ pre6-5-x25loop/net/x25/x25_route.c	Sat Apr 22 14:29:50 2000
@@ -148,6 +148,7 @@
 #if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE)
 	   || dev->type == ARPHRD_ETHER
 #endif
+	   || dev->type == ARPHRD_LOOPBACK
 	   ))
 		return dev;
 
