/* * manipulate eroutes * Copyright (C) 1996 John Ioannidis. * Copyright (C) 1997, 1998, 1999, 2000, 2001 Richard Guy Briggs. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. See . * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ #include #include /* new */ #include #include #include #include /* system() */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "constants.h" #include "libreswan/radij.h" #include "libreswan/ipsec_encap.h" #include "lswlog.h" #include "pfkey_help.h" #include "libreswan/pfkey_debug.h" #include "lsw_select.h" char *progname; static char me[] = "ipsec eroute"; static char *eroute_af_opt, *said_af_opt, *edst_opt, *spi_opt, *proto_opt, *said_opt, *dst_opt, *src_opt; static char *transport_proto_opt, *src_port_opt, *dst_port_opt; static int action_type = 0; static int pfkey_sock; static uint32_t pfkey_seq = 0; #define EMT_IFADDR 1 /* set enc if addr */ #define EMT_SETSPI 2 /* Set SPI properties */ #define EMT_DELSPI 3 /* Delete an SPI */ #define EMT_GRPSPIS 4 /* Group SPIs (output order) */ #define EMT_SETEROUTE 5 /* set an extended route */ #define EMT_DELEROUTE 6 /* del an extended route */ #define EMT_TESTROUTE 7 /* try to find route, print to console */ #define EMT_SETDEBUG 8 /* set debug level if active */ #define EMT_UNGRPSPIS 9 /* UnGroup SPIs (output order) */ #define EMT_CLREROUTE 10 /* clear the extended route table */ #define EMT_CLRSPIS 11 /* clear the spi table */ #define EMT_REPLACEROUTE 12 /* set an extended route */ #define EMT_GETDEBUG 13 /* get debug level if active */ #define EMT_INEROUTE 14 /* set incoming policy for IPIP on a chain */ #define EMT_INREPLACEROUTE 15 /* replace incoming policy for IPIP on a chain */ static void usage(char* arg) { fprintf(stdout, "usage: %s --{add,addin,replace,replacein} --eraf --src /| --dst /| [ --transport-proto ] [ --src-port ] [ --dst-port ] \n", arg); fprintf(stdout, " where is '--af --edst --spi --proto '\n"); fprintf(stdout, " OR '--said '\n"); fprintf(stdout, " OR '--said <%%passthrough | %%passthrough4 | %%passthrough6 | %%drop | %%reject | %%trap | %%hold | %%pass>'.\n"); fprintf(stdout, " %s --del --eraf --src /| --dst /| [ --transport-proto ] [ --src-port ] [ --dst-port ]\n", arg); fprintf(stdout, " %s --clear\n", arg); fprintf(stdout, " %s --help\n", arg); fprintf(stdout, " %s --version\n", arg); fprintf(stdout, " %s\n", arg); fprintf(stdout, " [ --debug ] is optional to any %s command.\n", arg); fprintf(stdout, " [ --label