Add support for console over UDP (compatible to Ingo Molnar's
netconsole patch under Linux)
diff --git a/net/net.c b/net/net.c
index 6e0288d..261f7c1 100644
--- a/net/net.c
+++ b/net/net.c
@@ -148,6 +148,11 @@
 static void CDPStart(void);
 #endif
 
+#ifdef CONFIG_NETCONSOLE
+void NcStart(void);
+int nc_input_packet(uchar *pkt, unsigned dest, unsigned src, unsigned len);
+#endif
+
 volatile uchar	PktBuf[(PKTBUFSRX+1) * PKTSIZE_ALIGN + PKTALIGN];
 
 volatile uchar *NetRxPackets[PKTBUFSRX]; /* Receive packets			*/
@@ -308,6 +313,7 @@
 #if (CONFIG_COMMANDS & CFG_CMD_PING)
 	case PING:
 #endif
+	case NETCONS:
 	case TFTP:
 		NetCopyIP(&NetOurIP, &bd->bi_ip_addr);
 		NetOurGatewayIP = getenv_IPaddr ("gatewayip");
@@ -319,6 +325,7 @@
 #if (CONFIG_COMMANDS & CFG_CMD_NFS)
 		case NFS:
 #endif
+		case NETCONS:
 		case TFTP:
 			NetServerIP = getenv_IPaddr ("serverip");
 			break;
@@ -404,6 +411,11 @@
 			CDPStart();
 			break;
 #endif
+#ifdef CONFIG_NETCONSOLE
+		case NETCONS:
+			NcStart();
+			break;
+#endif
 		default:
 			break;
 		}
@@ -1259,6 +1271,9 @@
 				/* save address for later use */
 				memcpy(NetArpWaitPacketMAC, &arp->ar_data[0], 6);
 
+#ifdef CONFIG_NETCONSOLE
+				(*packetHandler)(0,0,0,0);
+#endif
 				/* modify header, and transmit it */
 				memcpy(((Ethernet_t *)NetArpWaitTxPacket)->et_dest, NetArpWaitPacketMAC, 6);
 				(void) eth_send(NetArpWaitTxPacket, NetArpWaitTxPacketSize);
@@ -1377,6 +1392,12 @@
 			return;
 		}
 
+#ifdef CONFIG_NETCONSOLE
+		nc_input_packet((uchar *)ip +IP_HDR_SIZE,
+						ntohs(ip->udp_dst),
+						ntohs(ip->udp_src),
+						ntohs(ip->udp_len) - 8);
+#endif
 		/*
 		 *	IP header OK.  Pass the packet to the current handler.
 		 */
@@ -1406,6 +1427,7 @@
 #if (CONFIG_COMMANDS & CFG_CMD_NFS)
 	case NFS:
 #endif
+	case NETCONS:
 	case TFTP:
 		if (NetServerIP == 0) {
 			puts ("*** ERROR: `serverip' not set\n");