]> git.saurik.com Git - apple/ipsec.git/blobdiff - ipsec-tools/setkey/setkey.c
ipsec-332.100.1.tar.gz
[apple/ipsec.git] / ipsec-tools / setkey / setkey.c
index a301b6950dc37c8875d013edb4794c567f4b0e55..8bd759a7fad3242a44983f105962efd1a5563214 100644 (file)
@@ -41,7 +41,7 @@
 #include <sys/sysctl.h>
 #include <err.h>
 #include <netinet/in.h>
 #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 
 #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 "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
 
 #define MODE_SCRIPT    1
 #define MODE_CMDDUMP   2
@@ -152,7 +149,7 @@ main(argc, argv)
        int c;
 
        if (argc == 1) {
        int c;
 
        if (argc == 1) {
-               usage(0);
+               usage();
                /* NOTREACHED */
        }
 
                /* NOTREACHED */
        }
 
@@ -170,10 +167,6 @@ main(argc, argv)
                case 'f':
                        f_mode = MODE_SCRIPT;
                        if ((fp = fopen(optarg, "r")) == NULL) {
                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*/
                        }
                                err(1, "fopen");
                                /*NOTREACHED*/
                        }
@@ -227,7 +220,7 @@ main(argc, argv)
 #endif
                        break;
                case 'V':
 #endif
                        break;
                case 'V':
-                       usage(1);
+                       usage();
                        break;
                        /*NOTREACHED*/
 #ifndef __NetBSD__
                        break;
                        /*NOTREACHED*/
 #ifndef __NetBSD__
@@ -235,7 +228,7 @@ main(argc, argv)
 #endif
                case '?':
                default:
 #endif
                case '?':
                default:
-                       usage(0);
+                       usage();
                        /*NOTREACHED*/
                }
        }
                        /*NOTREACHED*/
                }
        }
@@ -246,10 +239,6 @@ main(argc, argv)
        if (argc > 0) {
                while (argc--)
                        if (fileproc(*argv++) < 0) {
        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*/
                        }
                                err(1, "%s", argv[-1]);
                                /*NOTREACHED*/
                        }
@@ -258,10 +247,6 @@ main(argc, argv)
 
        so = pfkey_open();
        if (so < 0) {
 
        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);
        }
                perror("pfkey_open");
                exit(1);
        }
@@ -283,10 +268,6 @@ main(argc, argv)
                break;
        case MODE_STDIN:
                if (get_supported() < 0) {
                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*/
                }
                        errx(1, "%s", ipsec_strerror());
                        /*NOTREACHED*/
                }
@@ -296,7 +277,7 @@ main(argc, argv)
                promisc();
                /*NOTREACHED*/
        default:
                promisc();
                /*NOTREACHED*/
        default:
-               usage(0);
+               usage();
                /*NOTREACHED*/
        }
 
                /*NOTREACHED*/
        }