#include <sys/sysctl.h>
#include <err.h>
#include <netinet/in.h>
-#include <System/net/pfkeyv2.h>
+#include <net/pfkeyv2.h>
#ifdef HAVE_NETINET6_IPSEC
# include <netinet6/ipsec.h>
#else
//#include "package_version.h"
#define extern /* so that variables in extern.h are not extern... */
#include "extern.h"
-#include "ipsecPolicyTracer.h"
-#include "ipsecMessageTracer.h"
-
-
-void usage __P((/*int*/));
-int main __P((int, char **));
-int get_supported __P((void));
-void sendkeyshort __P((u_int));
-void promisc __P((void));
-int postproc __P((struct sadb_msg *, int));
-int verifypriority __P((struct sadb_msg *m));
-int fileproc __P((const char *));
-const char *numstr __P((int));
-void shortdump_hdr __P((void));
-void shortdump __P((struct sadb_msg *));
-static void printdate __P((void));
-static int32_t gmt2local __P((time_t));
-void stdin_loop __P((void));
+
+void usage (/*int*/);
+int main (int, char **);
+int get_supported (void);
+void sendkeyshort (u_int);
+void promisc (void);
+int postproc (struct sadb_msg *, int);
+int verifypriority (struct sadb_msg *m);
+int fileproc (const char *);
+const char *numstr (int);
+void shortdump_hdr (void);
+void shortdump (struct sadb_msg *);
+static void printdate (void);
+static int32_t gmt2local (time_t);
+void stdin_loop (void);
#define MODE_SCRIPT 1
#define MODE_CMDDUMP 2
int c;
if (argc == 1) {
- usage(0);
+ usage();
/* NOTREACHED */
}
case 'f':
f_mode = MODE_SCRIPT;
if ((fp = fopen(optarg, "r")) == NULL) {
- IPSECPOLICYTRACEREVENT(optarg,
- IPSECPOLICYEVENTCODE_SETKEY_ERROR,
- CONSTSTR("could not open policy file"),
- CONSTSTR("setkey -f : fopen erred"));
err(1, "fopen");
/*NOTREACHED*/
}
#endif
break;
case 'V':
- usage(1);
+ usage();
break;
/*NOTREACHED*/
#ifndef __NetBSD__
#endif
case '?':
default:
- usage(0);
+ usage();
/*NOTREACHED*/
}
}
if (argc > 0) {
while (argc--)
if (fileproc(*argv++) < 0) {
- IPSECPOLICYTRACEREVENT(argv[-1],
- IPSECPOLICYEVENTCODE_SETKEY_ERROR,
- CONSTSTR("could not parse policy file"),
- CONSTSTR("setkey: fileproc erred"));
err(1, "%s", argv[-1]);
/*NOTREACHED*/
}
so = pfkey_open();
if (so < 0) {
- IPSECPOLICYTRACEREVENT(argv[-1],
- IPSECPOLICYEVENTCODE_SETKEY_ERROR,
- CONSTSTR("couldn't open pfkey socket"),
- CONSTSTR("setkey: pfkey_open erred"));
perror("pfkey_open");
exit(1);
}
break;
case MODE_STDIN:
if (get_supported() < 0) {
- IPSECPOLICYTRACEREVENT("STDIN",
- IPSECPOLICYEVENTCODE_SETKEY_ERROR,
- CONSTSTR(ipsec_strerror()),
- CONSTSTR("setkey: get_supported erred"));
errx(1, "%s", ipsec_strerror());
/*NOTREACHED*/
}
promisc();
/*NOTREACHED*/
default:
- usage(0);
+ usage();
/*NOTREACHED*/
}