András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 1 | /* Code to restore the iptables state, from file by ip6tables-save. |
| 2 | * Author: Andras Kis-Szabo <kisza@sch.bme.hu> |
| 3 | * |
| 4 | * based on iptables-restore |
| 5 | * Authors: |
| 6 | * Harald Welte <laforge@gnumonks.org> |
| 7 | * Rusty Russell <rusty@linuxcare.com.au> |
| 8 | * |
Harald Welte | 80fe35d | 2002-05-29 13:08:15 +0000 | [diff] [blame] | 9 | * $Id: ip6tables-restore.c,v 1.8 2002/03/03 09:44:31 laforge Exp $ |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #include <getopt.h> |
| 13 | #include <sys/errno.h> |
| 14 | #include <string.h> |
| 15 | #include <stdio.h> |
| 16 | #include <stdlib.h> |
| 17 | #include "ip6tables.h" |
| 18 | #include "libiptc/libip6tc.h" |
| 19 | |
| 20 | #ifdef DEBUG |
| 21 | #define DEBUGP(x, args...) fprintf(stderr, x, ## args) |
| 22 | #else |
| 23 | #define DEBUGP(x, args...) |
| 24 | #endif |
| 25 | |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 26 | /* |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 27 | extern int for_each_chain(int (*fn)(const ip6t_chainlabel, int, ip6tc_handle_t *), int verbose, int builtinstoo, ip6tc_handle_t *handle); |
| 28 | extern int flush_entries(const ip6t_chainlabel chain, int verbose, ip6tc_handle_t *handle); |
| 29 | extern int delete_chain(const ip6t_chainlabel chain, int verbose, ip6tc_handle_t *handle); |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 30 | */ |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 31 | |
| 32 | static int binary = 0, counters = 0, verbose = 0, noflush = 0; |
| 33 | |
| 34 | /* Keeping track of external matches and targets. */ |
| 35 | static struct option options[] = { |
| 36 | { "binary", 0, 0, 'b' }, |
| 37 | { "counters", 0, 0, 'c' }, |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 38 | { "verbose", 1, 0, 'v' }, |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 39 | { "help", 0, 0, 'h' }, |
| 40 | { "noflush", 0, 0, 'n'}, |
Harald Welte | 5891865 | 2001-06-16 18:25:25 +0000 | [diff] [blame] | 41 | { "modprobe", 1, 0, 'M'}, |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 42 | { 0 } |
| 43 | }; |
| 44 | |
| 45 | static void print_usage(const char *name, const char *version) __attribute__((noreturn)); |
| 46 | |
| 47 | static void print_usage(const char *name, const char *version) |
| 48 | { |
| 49 | fprintf(stderr, "Usage: %s [-b] [-c] [-v] [-h]\n" |
| 50 | " [ --binary ]\n" |
| 51 | " [ --counters ]\n" |
| 52 | " [ --verbose ]\n" |
| 53 | " [ --help ]\n" |
Harald Welte | 5891865 | 2001-06-16 18:25:25 +0000 | [diff] [blame] | 54 | " [ --noflush ]\n" |
| 55 | " [ --modprobe=<command>]\n", name); |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 56 | |
| 57 | exit(1); |
| 58 | } |
| 59 | |
Harald Welte | 5891865 | 2001-06-16 18:25:25 +0000 | [diff] [blame] | 60 | ip6tc_handle_t create_handle(const char *tablename, const char* modprobe) |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 61 | { |
| 62 | ip6tc_handle_t handle; |
| 63 | |
| 64 | handle = ip6tc_init(tablename); |
Harald Welte | 5891865 | 2001-06-16 18:25:25 +0000 | [diff] [blame] | 65 | |
| 66 | if (!handle) { |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 67 | /* try to insmod the module if iptc_init failed */ |
| 68 | ip6tables_insmod("ip6_tables", modprobe); |
| 69 | handle = ip6tc_init(tablename); |
Harald Welte | 5891865 | 2001-06-16 18:25:25 +0000 | [diff] [blame] | 70 | } |
| 71 | |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 72 | if (!handle) { |
| 73 | exit_error(PARAMETER_PROBLEM, "%s: unable to initialize" |
| 74 | "table '%s'\n", program_name, tablename); |
| 75 | exit(1); |
| 76 | } |
| 77 | return handle; |
| 78 | } |
| 79 | |
| 80 | int parse_counters(char *string, struct ip6t_counters *ctr) |
| 81 | { |
| 82 | return (sscanf(string, "[%llu:%llu]", &ctr->pcnt, &ctr->bcnt) == 2); |
| 83 | } |
| 84 | |
Harald Welte | 885c6eb | 2001-10-04 08:30:46 +0000 | [diff] [blame] | 85 | /* global new argv and argc */ |
| 86 | static char *newargv[255]; |
| 87 | static int newargc; |
| 88 | |
| 89 | /* function adding one argument to newargv, updating newargc |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 90 | * returns true if argument added, false otherwise */ |
Harald Welte | 885c6eb | 2001-10-04 08:30:46 +0000 | [diff] [blame] | 91 | static int add_argv(char *what) { |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 92 | DEBUGP("add_argv: %s\n", what); |
| 93 | if (what && ((newargc + 1) < sizeof(newargv)/sizeof(char *))) { |
| 94 | newargv[newargc] = strdup(what); |
| 95 | newargc++; |
| 96 | return 1; |
| 97 | } else |
| 98 | return 0; |
Harald Welte | 885c6eb | 2001-10-04 08:30:46 +0000 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | static void free_argv(void) { |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 102 | int i; |
Harald Welte | 885c6eb | 2001-10-04 08:30:46 +0000 | [diff] [blame] | 103 | |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 104 | for (i = 0; i < newargc; i++) |
| 105 | free(newargv[i]); |
Harald Welte | 885c6eb | 2001-10-04 08:30:46 +0000 | [diff] [blame] | 106 | } |
| 107 | |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 108 | int main(int argc, char *argv[]) |
| 109 | { |
| 110 | ip6tc_handle_t handle; |
| 111 | char buffer[10240]; |
| 112 | unsigned int line = 0; |
| 113 | int c; |
| 114 | char curtable[IP6T_TABLE_MAXNAMELEN + 1]; |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 115 | FILE *in; |
Harald Welte | 5891865 | 2001-06-16 18:25:25 +0000 | [diff] [blame] | 116 | const char *modprobe = 0; |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 117 | |
| 118 | program_name = "ip6tables-restore"; |
Harald Welte | 80fe35d | 2002-05-29 13:08:15 +0000 | [diff] [blame] | 119 | program_version = IPTABLES_VERSION; |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 120 | |
Harald Welte | 3efb6ea | 2001-08-06 18:50:21 +0000 | [diff] [blame] | 121 | #ifdef NO_SHARED_LIBS |
| 122 | init_extensions(); |
| 123 | #endif |
| 124 | |
Harald Welte | 5891865 | 2001-06-16 18:25:25 +0000 | [diff] [blame] | 125 | while ((c = getopt_long(argc, argv, "bcvhnM:", options, NULL)) != -1) { |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 126 | switch (c) { |
| 127 | case 'b': |
| 128 | binary = 1; |
| 129 | break; |
| 130 | case 'c': |
| 131 | counters = 1; |
| 132 | break; |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 133 | case 'v': |
| 134 | verbose = 1; |
| 135 | break; |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 136 | case 'h': |
| 137 | print_usage("ip6tables-restore", |
Harald Welte | 80fe35d | 2002-05-29 13:08:15 +0000 | [diff] [blame] | 138 | IPTABLES_VERSION); |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 139 | break; |
| 140 | case 'n': |
| 141 | noflush = 1; |
| 142 | break; |
Harald Welte | 5891865 | 2001-06-16 18:25:25 +0000 | [diff] [blame] | 143 | case 'M': |
| 144 | modprobe = optarg; |
| 145 | break; |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 146 | } |
| 147 | } |
| 148 | |
| 149 | if (optind == argc - 1) { |
| 150 | in = fopen(argv[optind], "r"); |
| 151 | if (!in) { |
| 152 | fprintf(stderr, "Can't open %s: %s", argv[optind], |
| 153 | strerror(errno)); |
| 154 | exit(1); |
| 155 | } |
| 156 | } |
| 157 | else if (optind < argc) { |
| 158 | fprintf(stderr, "Unknown arguments found on commandline"); |
| 159 | exit(1); |
| 160 | } |
| 161 | else in = stdin; |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 162 | |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 163 | /* Grab standard input. */ |
| 164 | while (fgets(buffer, sizeof(buffer), in)) { |
| 165 | int ret; |
| 166 | |
| 167 | line++; |
| 168 | if (buffer[0] == '\n') continue; |
| 169 | else if (buffer[0] == '#') { |
| 170 | if (verbose) fputs(buffer, stdout); |
| 171 | continue; |
| 172 | } else if (strcmp(buffer, "COMMIT\n") == 0) { |
| 173 | DEBUGP("Calling commit\n"); |
| 174 | ret = ip6tc_commit(&handle); |
| 175 | } else if (buffer[0] == '*') { |
| 176 | /* New table */ |
| 177 | char *table; |
| 178 | |
| 179 | table = strtok(buffer+1, " \t\n"); |
| 180 | DEBUGP("line %u, table '%s'\n", line, table); |
| 181 | if (!table) { |
| 182 | exit_error(PARAMETER_PROBLEM, |
| 183 | "%s: line %u table name invalid\n", |
| 184 | program_name, line); |
| 185 | exit(1); |
| 186 | } |
| 187 | strncpy(curtable, table, IP6T_TABLE_MAXNAMELEN); |
| 188 | |
Harald Welte | 5891865 | 2001-06-16 18:25:25 +0000 | [diff] [blame] | 189 | handle = create_handle(table, modprobe); |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 190 | if (noflush == 0) { |
| 191 | DEBUGP("Cleaning all chains of table '%s'\n", |
| 192 | table); |
| 193 | for_each_chain(flush_entries, verbose, 1, |
| 194 | &handle); |
| 195 | |
| 196 | DEBUGP("Deleting all user-defined chains " |
| 197 | "of table '%s'\n", table); |
| 198 | for_each_chain(delete_chain, verbose, 0, |
| 199 | &handle) ; |
| 200 | } |
| 201 | |
| 202 | ret = 1; |
| 203 | |
| 204 | } else if (buffer[0] == ':') { |
| 205 | /* New chain. */ |
| 206 | char *policy, *chain; |
| 207 | |
| 208 | chain = strtok(buffer+1, " \t\n"); |
| 209 | DEBUGP("line %u, chain '%s'\n", line, chain); |
| 210 | if (!chain) { |
| 211 | exit_error(PARAMETER_PROBLEM, |
| 212 | "%s: line %u chain name invalid\n", |
| 213 | program_name, line); |
| 214 | exit(1); |
| 215 | } |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 216 | |
Harald Welte | 885c6eb | 2001-10-04 08:30:46 +0000 | [diff] [blame] | 217 | if (!ip6tc_builtin(chain, handle)) { |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 218 | DEBUGP("Creating new chain '%s'\n", chain); |
Harald Welte | 885c6eb | 2001-10-04 08:30:46 +0000 | [diff] [blame] | 219 | if (!ip6tc_create_chain(chain, &handle)) |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 220 | exit_error(PARAMETER_PROBLEM, |
| 221 | "error creating chain " |
| 222 | "'%s':%s\n", chain, |
| 223 | strerror(errno)); |
Harald Welte | 885c6eb | 2001-10-04 08:30:46 +0000 | [diff] [blame] | 224 | } |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 225 | |
| 226 | policy = strtok(NULL, " \t\n"); |
| 227 | DEBUGP("line %u, policy '%s'\n", line, policy); |
| 228 | if (!policy) { |
| 229 | exit_error(PARAMETER_PROBLEM, |
| 230 | "%s: line %u policy invalid\n", |
| 231 | program_name, line); |
| 232 | exit(1); |
| 233 | } |
| 234 | |
| 235 | if (strcmp(policy, "-") != 0) { |
| 236 | struct ip6t_counters count; |
| 237 | |
| 238 | if (counters) { |
| 239 | char *ctrs; |
| 240 | ctrs = strtok(NULL, " \t\n"); |
| 241 | |
| 242 | parse_counters(ctrs, &count); |
| 243 | |
| 244 | } else { |
| 245 | memset(&count, 0, |
| 246 | sizeof(struct ip6t_counters)); |
| 247 | } |
| 248 | |
| 249 | DEBUGP("Setting policy of chain %s to %s\n", |
| 250 | chain, policy); |
| 251 | |
| 252 | if (!ip6tc_set_policy(chain, policy, &count, |
| 253 | &handle)) |
| 254 | exit_error(OTHER_PROBLEM, |
| 255 | "Can't set policy `%s'" |
| 256 | " on `%s' line %u: %s\n", |
| 257 | chain, policy, line, |
| 258 | ip6tc_strerror(errno)); |
| 259 | } |
| 260 | |
| 261 | ret = 1; |
| 262 | |
| 263 | } else { |
Harald Welte | 885c6eb | 2001-10-04 08:30:46 +0000 | [diff] [blame] | 264 | int a; |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 265 | char *ptr = buffer; |
| 266 | char *pcnt = NULL; |
| 267 | char *bcnt = NULL; |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 268 | char *parsestart; |
Harald Welte | 885c6eb | 2001-10-04 08:30:46 +0000 | [diff] [blame] | 269 | |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 270 | /* the parser */ |
| 271 | char *param_start, *curchar; |
| 272 | int quote_open; |
Harald Welte | 885c6eb | 2001-10-04 08:30:46 +0000 | [diff] [blame] | 273 | |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 274 | /* reset the newargv */ |
| 275 | newargc = 0; |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 276 | |
| 277 | if (buffer[0] == '[') { |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 278 | /* we have counters in our input */ |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 279 | ptr = strchr(buffer, ']'); |
| 280 | if (!ptr) |
| 281 | exit_error(PARAMETER_PROBLEM, |
| 282 | "Bad line %u: need ]\n", |
| 283 | line); |
Harald Welte | 885c6eb | 2001-10-04 08:30:46 +0000 | [diff] [blame] | 284 | |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 285 | pcnt = strtok(buffer+1, ":"); |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 286 | if (!pcnt) |
| 287 | exit_error(PARAMETER_PROBLEM, |
| 288 | "Bad line %u: need :\n", |
| 289 | line); |
Harald Welte | 885c6eb | 2001-10-04 08:30:46 +0000 | [diff] [blame] | 290 | |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 291 | bcnt = strtok(NULL, "]"); |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 292 | if (!bcnt) |
| 293 | exit_error(PARAMETER_PROBLEM, |
| 294 | "Bad line %u: need ]\n", |
| 295 | line); |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 296 | |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 297 | /* start command parsing after counter */ |
| 298 | parsestart = ptr + 1; |
| 299 | } else { |
| 300 | /* start command parsing at start of line */ |
| 301 | parsestart = buffer; |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 302 | } |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 303 | |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 304 | add_argv(argv[0]); |
| 305 | add_argv("-t"); |
| 306 | add_argv((char *) &curtable); |
| 307 | |
| 308 | if (counters && pcnt && bcnt) { |
| 309 | add_argv("--set-counters"); |
| 310 | add_argv((char *) pcnt); |
| 311 | add_argv((char *) bcnt); |
| 312 | } |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 313 | |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 314 | /* After fighting with strtok enough, here's now |
| 315 | * a 'real' parser. According to Rusty I'm now no |
| 316 | * longer a real hacker, but I can live with that */ |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 317 | |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 318 | quote_open = 0; |
| 319 | param_start = parsestart; |
| 320 | |
| 321 | for (curchar = parsestart; *curchar; curchar++) { |
| 322 | if (*curchar == '"') { |
| 323 | if (quote_open) { |
| 324 | quote_open = 0; |
| 325 | *curchar = ' '; |
| 326 | } else { |
| 327 | quote_open = 1; |
| 328 | param_start++; |
| 329 | } |
| 330 | } |
| 331 | if (*curchar == ' ' |
| 332 | || *curchar == '\t' |
| 333 | || * curchar == '\n') { |
| 334 | char param_buffer[1024]; |
| 335 | int param_len = curchar-param_start; |
Harald Welte | 885c6eb | 2001-10-04 08:30:46 +0000 | [diff] [blame] | 336 | |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 337 | if (quote_open) |
| 338 | continue; |
Harald Welte | 885c6eb | 2001-10-04 08:30:46 +0000 | [diff] [blame] | 339 | |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 340 | if (!param_len) { |
| 341 | /* two spaces? */ |
| 342 | param_start++; |
| 343 | continue; |
| 344 | } |
| 345 | |
| 346 | /* end of one parameter */ |
| 347 | strncpy(param_buffer, param_start, |
| 348 | param_len); |
| 349 | *(param_buffer+param_len) = '\0'; |
Harald Welte | bb41f88 | 2001-10-21 14:11:54 +0000 | [diff] [blame] | 350 | |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 351 | /* check if table name specified */ |
Harald Welte | 48a6f90 | 2001-10-22 15:16:21 +0000 | [diff] [blame] | 352 | if (!strncmp(param_buffer, "-t", 3) |
| 353 | || !strncmp(param_buffer, "--table", 8)) { |
Harald Welte | bb41f88 | 2001-10-21 14:11:54 +0000 | [diff] [blame] | 354 | exit_error(PARAMETER_PROBLEM, |
| 355 | "Line %u seems to have a " |
| 356 | "-t table option.\n", line); |
| 357 | exit(1); |
| 358 | } |
| 359 | |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 360 | add_argv(param_buffer); |
| 361 | param_start += param_len + 1; |
| 362 | } else { |
| 363 | /* regular character, skip */ |
| 364 | } |
| 365 | } |
Harald Welte | 885c6eb | 2001-10-04 08:30:46 +0000 | [diff] [blame] | 366 | |
| 367 | DEBUGP("calling do_command6(%u, argv, &%s, handle):\n", |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 368 | newargc, curtable); |
Harald Welte | 885c6eb | 2001-10-04 08:30:46 +0000 | [diff] [blame] | 369 | |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 370 | for (a = 0; a < newargc; a++) |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 371 | DEBUGP("argv[%u]: %s\n", a, newargv[a]); |
| 372 | |
Harald Welte | 885c6eb | 2001-10-04 08:30:46 +0000 | [diff] [blame] | 373 | ret = do_command6(newargc, newargv, |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 374 | &newargv[2], &handle); |
Harald Welte | 885c6eb | 2001-10-04 08:30:46 +0000 | [diff] [blame] | 375 | |
András Kis-Szabó | 97fd91a | 2002-03-03 09:44:31 +0000 | [diff] [blame] | 376 | free_argv(); |
András Kis-Szabó | 2f52379 | 2001-02-27 09:59:48 +0000 | [diff] [blame] | 377 | } |
| 378 | if (!ret) { |
| 379 | fprintf(stderr, "%s: line %u failed\n", |
| 380 | program_name, line); |
| 381 | exit(1); |
| 382 | } |
| 383 | } |
| 384 | |
| 385 | return 0; |
| 386 | } |