--- busybox-1.6.0/networking/nc.c	2007-06-01 13:48:29.000000000 +0200
+++ src/networking/nc.c	2008-01-17 14:25:53.000000000 +0100
@@ -29,6 +29,7 @@
 	int sfd = sfd; /* for gcc */
 	int cfd = 0;
 	unsigned lport = 0;
+	unsigned use_udp = 0;
 	SKIP_NC_SERVER(const) unsigned do_listen = 0;
 	SKIP_NC_EXTRA (const) unsigned wsecs = 0;
 	SKIP_NC_EXTRA (const) unsigned delay = 0;
@@ -42,9 +43,10 @@
 		/* getopt32 is _almost_ usable:
 		** it cannot handle "... -e prog -prog-opt" */
 		while ((opt = getopt(argc, argv,
-		        "" USE_NC_SERVER("lp:") USE_NC_EXTRA("w:i:f:e:") )) > 0
+		        "u" USE_NC_SERVER("lp:") USE_NC_EXTRA("w:i:f:e:") )) > 0
 		) {
-			if (ENABLE_NC_SERVER && opt=='l')      USE_NC_SERVER(do_listen++);
+			if (opt=='u') use_udp = 1;
+			else if (ENABLE_NC_SERVER && opt=='l')      USE_NC_SERVER(do_listen++);
 			else if (ENABLE_NC_SERVER && opt=='p') {
 				USE_NC_SERVER(lport = bb_lookup_port(optarg, "tcp", 0));
 			}
@@ -95,7 +97,7 @@
 	}
 
 	if (!cfd) {
-		if (do_listen) {
+		if (do_listen && !use_udp) {
 			/* create_and_bind_stream_or_die(NULL, lport)
 			 * would've work wonderfully, but we need
 			 * to know lsa */
@@ -120,9 +122,20 @@
 				bb_perror_msg_and_die("accept");
 			if (!execparam)
 				close(sfd);
-		} else {
+		} else if (do_listen && use_udp) {
+			cfd = xsocket_type(&lsa, SOCK_DGRAM);
+			if (lport)
+				set_nport(lsa, htons(lport));
+			setsockopt_reuseaddr(sfd);
+			xbind(cfd, &lsa->sa, lsa->len);
+		} else if (!use_udp) {
 			cfd = create_and_connect_stream_or_die(argv[0],
 				argv[1] ? bb_lookup_port(argv[1], "tcp", 0) : 0);
+		} else {
+			lsa = xhost2sockaddr(argv[0],
+				argv[1] ? bb_lookup_port(argv[1], "udp", 0) : 0);
+			cfd = xsocket(lsa->sa.sa_family, SOCK_DGRAM, 0);
+			xconnect(cfd, &lsa->sa, lsa->len);
 		}
 	}
 
