Module Name: src
Committed By: pooka
Date: Thu Nov 11 22:56:39 UTC 2010
Modified Files:
src/sbin/ping: Makefile ping.c
Log Message:
add compile-conditional rumpclient support
To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sbin/ping/Makefile
cvs rdiff -u -r1.90 -r1.91 src/sbin/ping/ping.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/ping/Makefile
diff -u src/sbin/ping/Makefile:1.14 src/sbin/ping/Makefile:1.15
--- src/sbin/ping/Makefile:1.14 Mon May 28 12:06:23 2007
+++ src/sbin/ping/Makefile Thu Nov 11 22:56:38 2010
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.14 2007/05/28 12:06:23 tls Exp $
+# $NetBSD: Makefile,v 1.15 2010/11/11 22:56:38 pooka Exp $
# @(#)Makefile 8.1 (Berkeley) 6/5/93
USE_FORT?= yes # setuid
@@ -12,4 +12,16 @@
LDADD+= -lipsec
DPADD+= ${LIBIPSEC}
+#
+# Compile-time debug flag. If compiled with "make RUMP_ACTION=1",
+# make rump system calls. This allows to single-step ioctl commands
+# to figure out where ioctl's go in the kernel.
+#
+.ifdef RUMP_ACTION
+CPPFLAGS+= -DRUMP_SYS_NETWORKING -DRUMP_SYS_IOCTL -DRUMP_SYS_CLOSE
+CPPFLAGS+= -DRUMP_ACTION
+LDADD+= -lrumpclient
+DBG= -g
+.endif
+
.include <bsd.prog.mk>
Index: src/sbin/ping/ping.c
diff -u src/sbin/ping/ping.c:1.90 src/sbin/ping/ping.c:1.91
--- src/sbin/ping/ping.c:1.90 Mon Nov 2 00:47:09 2009
+++ src/sbin/ping/ping.c Thu Nov 11 22:56:38 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: ping.c,v 1.90 2009/11/02 00:47:09 christos Exp $ */
+/* $NetBSD: ping.c,v 1.91 2010/11/11 22:56:38 pooka Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -58,7 +58,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: ping.c,v 1.90 2009/11/02 00:47:09 christos Exp $");
+__RCSID("$NetBSD: ping.c,v 1.91 2010/11/11 22:56:38 pooka Exp $");
#endif
#include <stdio.h>
@@ -92,6 +92,13 @@
#include <netinet6/ipsec.h>
#endif /*IPSEC*/
+#ifdef RUMP_ACTION
+#include <rump/rump.h>
+#include <rump/rump_syscalls.h>
+#include <rump/rumpclient.h>
+#define poll(a,b,c) rump_sys_poll(a,b,c)
+#endif
+
#define FLOOD_INTVL 0.01 /* default flood output interval */
#define MAXPACKET (IP_MAXPACKET-60-8) /* max packet size */
@@ -244,6 +251,11 @@
struct sigaction sa;
#endif
+#ifdef RUMP_ACTION
+ if (rumpclient_init() == -1)
+ err(1, "rumpclient init failed");
+#endif
+
if ((s = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP)) < 0)
err(1, "Cannot create socket");
if ((sloop = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP)) < 0)