]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
Drop extra newline from xtables_error() calls
authorPhil Sutter <phil@nwl.cc>
Fri, 7 Jan 2022 15:26:30 +0000 (16:26 +0100)
committerPhil Sutter <phil@nwl.cc>
Tue, 15 Nov 2022 16:02:09 +0000 (17:02 +0100)
Since basic_exit_err() appends a newline to the message itself, drop
explicit ones.

While being at it, fix indentation and join texts split over multiple
lines.

Signed-off-by: Phil Sutter <phil@nwl.cc>
24 files changed:
extensions/dscp_helper.c
extensions/libebt_among.c
extensions/libip6t_mh.c
extensions/libipt_CLUSTERIP.c
extensions/libxt_CONNSECMARK.c
extensions/libxt_CT.c
extensions/libxt_SECMARK.c
extensions/libxt_bpf.c
extensions/libxt_hashlimit.c
extensions/libxt_limit.c
extensions/libxt_sctp.c
extensions/libxt_set.c
iptables/ip6tables.c
iptables/iptables-restore.c
iptables/iptables-save.c
iptables/iptables-xml.c
iptables/iptables.c
iptables/nft-cache.c
iptables/nft.c
iptables/xshared.c
iptables/xtables-eb-translate.c
iptables/xtables-eb.c
iptables/xtables-restore.c
libxtables/xtoptions.c

index 75b1fece09a63e17fd3f07bef4df3dfee6652993..1f20b2a5f326d1bc9353bd34229247dd5e706dc8 100644 (file)
@@ -58,7 +58,7 @@ class_to_dscp(const char *name)
        }
 
        xtables_error(PARAMETER_PROBLEM,
-                       "Invalid DSCP value `%s'\n", name);
+                     "Invalid DSCP value `%s'", name);
 }
 
 
@@ -73,7 +73,7 @@ dscp_to_name(unsigned int dscp)
                        return ds_classes[i].name;
 
        xtables_error(PARAMETER_PROBLEM,
-                       "Invalid DSCP value `%d'\n", dscp);
+                     "Invalid DSCP value `%d'", dscp);
 }
 #endif
 
index 1eab20198440808aae86deab366e3ce6b5a01eb9..a80fb80404ee1e4230680fbcdcae0520cc9addc8 100644 (file)
@@ -68,12 +68,12 @@ parse_nft_among_pair(char *buf, struct nft_among_pair *pair, bool have_ip)
 
                if (!inet_pton(AF_INET, sep + 1, &pair->in))
                        xtables_error(PARAMETER_PROBLEM,
-                                     "Invalid IP address '%s'\n", sep + 1);
+                                     "Invalid IP address '%s'", sep + 1);
        }
        ether = ether_aton(buf);
        if (!ether)
                xtables_error(PARAMETER_PROBLEM,
-                             "Invalid MAC address '%s'\n", buf);
+                             "Invalid MAC address '%s'", buf);
        memcpy(&pair->ether, ether, sizeof(*ether));
 }
 
index 64675405ac72487478d928599c7a7337d1bc55f1..1410d324b5d42d11a8a7a34e3fa65e78391252db 100644 (file)
@@ -97,7 +97,7 @@ static unsigned int name_to_type(const char *name)
 
                if (!xtables_strtoui(name, NULL, &number, 0, UINT8_MAX))
                        xtables_error(PARAMETER_PROBLEM,
-                                  "Invalid MH type `%s'\n", name);
+                                     "Invalid MH type `%s'", name);
                return number;
        }
 }
index f4b638b2045adbd37ec8a51caa00985de9fcafbf..b207cde3e3fbd4a52c205ecbdfa7a1f099bd7c44 100644 (file)
@@ -87,12 +87,13 @@ static void CLUSTERIP_parse(struct xt_option_call *cb)
                else if (strcmp(cb->arg, "sourceip-sourceport-destport") == 0)
                        cipinfo->hash_mode = CLUSTERIP_HASHMODE_SIP_SPT_DPT;
                else
-                       xtables_error(PARAMETER_PROBLEM, "Unknown hashmode \"%s\"\n",
-                                  cb->arg);
+                       xtables_error(PARAMETER_PROBLEM,
+                                     "Unknown hashmode \"%s\"", cb->arg);
                break;
        case O_CLUSTERMAC:
                if (!(cipinfo->clustermac[0] & 0x01))
-                       xtables_error(PARAMETER_PROBLEM, "MAC has to be a multicast ethernet address\n");
+                       xtables_error(PARAMETER_PROBLEM,
+                                     "MAC has to be a multicast ethernet address");
                break;
        case O_LOCAL_NODE:
                cipinfo->num_local_nodes = 1;
@@ -107,7 +108,8 @@ static void CLUSTERIP_check(struct xt_fcheck_call *cb)
        if ((cb->xflags & F_FULL) == F_FULL)
                return;
 
-       xtables_error(PARAMETER_PROBLEM, "CLUSTERIP target: Invalid parameter combination\n");
+       xtables_error(PARAMETER_PROBLEM,
+                     "CLUSTERIP target: Invalid parameter combination");
 }
 
 static const char *hashmode2str(enum clusterip_hashmode mode)
index 0b3cd79d7ebdf09a35366129121022aff0172b15..6da589d307cb08451347342f2d9289b38e2aa6e5 100644 (file)
@@ -66,7 +66,8 @@ static void print_connsecmark(const struct xt_connsecmark_target_info *info)
                break;
                
        default:
-               xtables_error(OTHER_PROBLEM, PFX "invalid mode %hhu\n", info->mode);
+               xtables_error(OTHER_PROBLEM,
+                             PFX "invalid mode %hhu", info->mode);
        }
 }
 
index fbbbe2660e9fc075ee6ea1879f59be3c18c67017..188246657582dde4a5ee50ac981c2ed205472935 100644 (file)
@@ -117,7 +117,7 @@ static void ct_parse_zone_id(const char *opt, unsigned int opt_id,
 
                if (!xtables_strtoul(opt, NULL, &val, 0, UINT16_MAX))
                        xtables_error(PARAMETER_PROBLEM,
-                                     "Cannot parse %s as a zone ID\n", opt);
+                                     "Cannot parse %s as a zone ID", opt);
 
                *zone_id = (uint16_t)val;
        }
index 24249bd618ffed8a2d2496bbcf2e91aa704ba3eb..a4ee60f0185a0dd4533a1471ab92fddd638a1e2e 100644 (file)
@@ -60,7 +60,7 @@ static void print_secmark(__u8 mode, const char *secctx)
                break;
 
        default:
-               xtables_error(OTHER_PROBLEM, PFX "invalid mode %hhu\n", mode);
+               xtables_error(OTHER_PROBLEM, PFX "invalid mode %hhu", mode);
        }
 }
 
index eeae86e5504c0902a22c88fa2fa248cd25209a07..5e0358374e57bc2833c47eba4b63abebe11ec0d1 100644 (file)
@@ -83,8 +83,7 @@ static int bpf_obj_get_readonly(const char *filepath)
        attr.file_flags = 0;
        return syscall(__NR_bpf, BPF_OBJ_GET, &attr, sizeof(attr));
 #else
-       xtables_error(OTHER_PROBLEM,
-                     "No bpf header, kernel headers too old?\n");
+       xtables_error(OTHER_PROBLEM, "No bpf header, kernel headers too old?");
        return -EINVAL;
 #endif
 }
index 3f3c43010ee2a3b4a1d89576f720154d40f71b62..93ee1c32e54c3180b81940c756f8b2a3ed2518da 100644 (file)
@@ -356,12 +356,12 @@ static bool parse_bytes(const char *rate, void *val, struct hashlimit_mt_udata *
        tmp = (uint64_t) r * factor;
        if (tmp > max)
                xtables_error(PARAMETER_PROBLEM,
-                       "Rate value too large \"%"PRIu64"\" (max %"PRIu64")\n",
-                                       tmp, max);
+                             "Rate value too large \"%"PRIu64"\" (max %"PRIu64")",
+                             tmp, max);
 
        tmp = bytes_to_cost(tmp);
        if (tmp == 0)
-               xtables_error(PARAMETER_PROBLEM, "Rate too high \"%s\"\n", rate);
+               xtables_error(PARAMETER_PROBLEM, "Rate too high \"%s\"", rate);
 
        ud->mult = XT_HASHLIMIT_BYTE_EXPIRE;
 
@@ -407,7 +407,7 @@ int parse_rate(const char *rate, void *val, struct hashlimit_mt_udata *ud, int r
                 * The rate maps to infinity. (1/day is the minimum they can
                 * specify, so we are ok at that end).
                 */
-               xtables_error(PARAMETER_PROBLEM, "Rate too fast \"%s\"\n", rate);
+               xtables_error(PARAMETER_PROBLEM, "Rate too fast \"%s\"", rate);
 
        if(revision == 1)
                *((uint32_t*)val) = tmp;
index 1b3246575f2293917f35e326cbd07c94a7783cfd..e6ec67f30268871e78046d6e95d114e90a2ff835 100644 (file)
@@ -77,7 +77,7 @@ int parse_rate(const char *rate, uint32_t *val)
                 * The rate maps to infinity. (1/day is the minimum they can
                 * specify, so we are ok at that end).
                 */
-               xtables_error(PARAMETER_PROBLEM, "Rate too fast \"%s\"\n", rate);
+               xtables_error(PARAMETER_PROBLEM, "Rate too fast \"%s\"", rate);
        return 1;
 }
 
@@ -93,7 +93,7 @@ static void limit_init(struct xt_entry_match *m)
 /* FIXME: handle overflow:
        if (r->avg*r->burst/r->burst != r->avg)
                xtables_error(PARAMETER_PROBLEM,
-                          "Sorry: burst too large for that avg rate.\n");
+                             "Sorry: burst too large for that avg rate.");
 */
 
 static void limit_parse(struct xt_option_call *cb)
index 3fb6cf1ab1b5357dfacad2b07b91c9d7830c7ec3..8f069a43e7b71f64f22186f92dbcc75ff2f3a800 100644 (file)
@@ -144,10 +144,8 @@ save_chunk_flag_info(struct xt_sctp_flag_info *flag_info,
        }
        
        if (*flag_count == XT_NUM_SCTP_FLAGS) {
-               xtables_error (PARAMETER_PROBLEM,
-                       "Number of chunk types with flags exceeds currently allowed limit."
-                       "Increasing this limit involves changing IPT_NUM_SCTP_FLAGS and"
-                       "recompiling both the kernel space and user space modules\n");
+               xtables_error(PARAMETER_PROBLEM,
+                             "Number of chunk types with flags exceeds currently allowed limit. Increasing this limit involves changing IPT_NUM_SCTP_FLAGS and recompiling both the kernel space and user space modules");
        }
 
        flag_info[*flag_count].chunktype = chunktype;
@@ -219,7 +217,8 @@ parse_sctp_chunk(struct xt_sctp_info *einfo,
                                                isupper(chunk_flags[j]));
                                } else {
                                        xtables_error(PARAMETER_PROBLEM,
-                                               "Invalid flags for chunk type %d\n", i);
+                                                     "Invalid flags for chunk type %d",
+                                                     i);
                                }
                        }
                }
index a2137ab1eb1803db5cb5fea5068cca32df1dc9e3..471bde8a815d24aeb9857f6ac7d50722bfecac76 100644 (file)
@@ -334,8 +334,7 @@ parse_counter(const char *opt)
 
        if (!xtables_strtoul(opt, NULL, &value, 0, UINT64_MAX))
                xtables_error(PARAMETER_PROBLEM,
-                             "Cannot parse %s as a counter value\n",
-                             opt);
+                             "Cannot parse %s as a counter value", opt);
        return (uint64_t)value;
 }
 
@@ -354,60 +353,54 @@ set_parse_v3(int c, char **argv, int invert, unsigned int *flags,
        case '0':
                if (info->bytes.op != IPSET_COUNTER_NONE)
                        xtables_error(PARAMETER_PROBLEM,
-                                     "only one of the --bytes-[eq|lt|gt]"
-                                     " is allowed\n");
+                                     "only one of the --bytes-[eq|lt|gt] is allowed");
                if (invert)
                        xtables_error(PARAMETER_PROBLEM,
-                                     "--bytes-gt option cannot be inverted\n");
+                                     "--bytes-gt option cannot be inverted");
                info->bytes.op = IPSET_COUNTER_GT;
                info->bytes.value = parse_counter(optarg);
                break;
        case '9':
                if (info->bytes.op != IPSET_COUNTER_NONE)
                        xtables_error(PARAMETER_PROBLEM,
-                                     "only one of the --bytes-[eq|lt|gt]"
-                                     " is allowed\n");
+                                     "only one of the --bytes-[eq|lt|gt] is allowed");
                if (invert)
                        xtables_error(PARAMETER_PROBLEM,
-                                     "--bytes-lt option cannot be inverted\n");
+                                     "--bytes-lt option cannot be inverted");
                info->bytes.op = IPSET_COUNTER_LT;
                info->bytes.value = parse_counter(optarg);
                break;
        case '8':
                if (info->bytes.op != IPSET_COUNTER_NONE)
                        xtables_error(PARAMETER_PROBLEM,
-                                     "only one of the --bytes-[eq|lt|gt]"
-                                     " is allowed\n");
+                                     "only one of the --bytes-[eq|lt|gt] is allowed");
                info->bytes.op = invert ? IPSET_COUNTER_NE : IPSET_COUNTER_EQ;
                info->bytes.value = parse_counter(optarg);
                break;
        case '7':
                if (info->packets.op != IPSET_COUNTER_NONE)
                        xtables_error(PARAMETER_PROBLEM,
-                                     "only one of the --packets-[eq|lt|gt]"
-                                     " is allowed\n");
+                                     "only one of the --packets-[eq|lt|gt] is allowed");
                if (invert)
                        xtables_error(PARAMETER_PROBLEM,
-                                     "--packets-gt option cannot be inverted\n");
+                                     "--packets-gt option cannot be inverted");
                info->packets.op = IPSET_COUNTER_GT;
                info->packets.value = parse_counter(optarg);
                break;
        case '6':
                if (info->packets.op != IPSET_COUNTER_NONE)
                        xtables_error(PARAMETER_PROBLEM,
-                                     "only one of the --packets-[eq|lt|gt]"
-                                     " is allowed\n");
+                                     "only one of the --packets-[eq|lt|gt] is allowed");
                if (invert)
                        xtables_error(PARAMETER_PROBLEM,
-                                     "--packets-lt option cannot be inverted\n");
+                                     "--packets-lt option cannot be inverted");
                info->packets.op = IPSET_COUNTER_LT;
                info->packets.value = parse_counter(optarg);
                break;
        case '5':
                if (info->packets.op != IPSET_COUNTER_NONE)
                        xtables_error(PARAMETER_PROBLEM,
-                                     "only one of the --packets-[eq|lt|gt]"
-                                     " is allowed\n");
+                                     "only one of the --packets-[eq|lt|gt] is allowed");
                info->packets.op = invert ? IPSET_COUNTER_NE : IPSET_COUNTER_EQ;
                info->packets.value = parse_counter(optarg);
                break;
@@ -418,7 +411,7 @@ set_parse_v3(int c, char **argv, int invert, unsigned int *flags,
        case '3':
                if (invert)
                        xtables_error(PARAMETER_PROBLEM,
-                                     "--return-nomatch flag cannot be inverted\n");
+                                     "--return-nomatch flag cannot be inverted");
                info->flags |= IPSET_FLAG_RETURN_NOMATCH;
                break;
        case '2':
@@ -523,60 +516,54 @@ set_parse_v4(int c, char **argv, int invert, unsigned int *flags,
        case '0':
                if (info->bytes.op != IPSET_COUNTER_NONE)
                        xtables_error(PARAMETER_PROBLEM,
-                                     "only one of the --bytes-[eq|lt|gt]"
-                                     " is allowed\n");
+                                     "only one of the --bytes-[eq|lt|gt] is allowed");
                if (invert)
                        xtables_error(PARAMETER_PROBLEM,
-                                     "--bytes-gt option cannot be inverted\n");
+                                     "--bytes-gt option cannot be inverted");
                info->bytes.op = IPSET_COUNTER_GT;
                info->bytes.value = parse_counter(optarg);
                break;
        case '9':
                if (info->bytes.op != IPSET_COUNTER_NONE)
                        xtables_error(PARAMETER_PROBLEM,
-                                     "only one of the --bytes-[eq|lt|gt]"
-                                     " is allowed\n");
+                                     "only one of the --bytes-[eq|lt|gt] is allowed");
                if (invert)
                        xtables_error(PARAMETER_PROBLEM,
-                                     "--bytes-lt option cannot be inverted\n");
+                                     "--bytes-lt option cannot be inverted");
                info->bytes.op = IPSET_COUNTER_LT;
                info->bytes.value = parse_counter(optarg);
                break;
        case '8':
                if (info->bytes.op != IPSET_COUNTER_NONE)
                        xtables_error(PARAMETER_PROBLEM,
-                                     "only one of the --bytes-[eq|lt|gt]"
-                                     " is allowed\n");
+                                     "only one of the --bytes-[eq|lt|gt] is allowed");
                info->bytes.op = invert ? IPSET_COUNTER_NE : IPSET_COUNTER_EQ;
                info->bytes.value = parse_counter(optarg);
                break;
        case '7':
                if (info->packets.op != IPSET_COUNTER_NONE)
                        xtables_error(PARAMETER_PROBLEM,
-                                     "only one of the --packets-[eq|lt|gt]"
-                                     " is allowed\n");
+                                     "only one of the --packets-[eq|lt|gt] is allowed");
                if (invert)
                        xtables_error(PARAMETER_PROBLEM,
-                                     "--packets-gt option cannot be inverted\n");
+                                     "--packets-gt option cannot be inverted");
                info->packets.op = IPSET_COUNTER_GT;
                info->packets.value = parse_counter(optarg);
                break;
        case '6':
                if (info->packets.op != IPSET_COUNTER_NONE)
                        xtables_error(PARAMETER_PROBLEM,
-                                     "only one of the --packets-[eq|lt|gt]"
-                                     " is allowed\n");
+                                     "only one of the --packets-[eq|lt|gt] is allowed");
                if (invert)
                        xtables_error(PARAMETER_PROBLEM,
-                                     "--packets-lt option cannot be inverted\n");
+                                     "--packets-lt option cannot be inverted");
                info->packets.op = IPSET_COUNTER_LT;
                info->packets.value = parse_counter(optarg);
                break;
        case '5':
                if (info->packets.op != IPSET_COUNTER_NONE)
                        xtables_error(PARAMETER_PROBLEM,
-                                     "only one of the --packets-[eq|lt|gt]"
-                                     " is allowed\n");
+                                     "only one of the --packets-[eq|lt|gt] is allowed");
                info->packets.op = invert ? IPSET_COUNTER_NE : IPSET_COUNTER_EQ;
                info->packets.value = parse_counter(optarg);
                break;
@@ -587,7 +574,7 @@ set_parse_v4(int c, char **argv, int invert, unsigned int *flags,
        case '3':
                if (invert)
                        xtables_error(PARAMETER_PROBLEM,
-                                     "--return-nomatch flag cannot be inverted\n");
+                                     "--return-nomatch flag cannot be inverted");
                info->flags |= IPSET_FLAG_RETURN_NOMATCH;
                break;
        case '2':
index ae2670357264b26a1c1cc7a88c0e9bf904ae0380..062b2b152d554d25f73d594eeda8e95ce4f6ba91 100644 (file)
@@ -766,8 +766,8 @@ int do_command6(int argc, char *argv[], char **table,
 #ifdef IP6T_F_GOTO
                        if (cs.fw6.ipv6.flags & IP6T_F_GOTO)
                                xtables_error(PARAMETER_PROBLEM,
-                                               "goto '%s' is not a chain\n",
-                                               cs.jumpto);
+                                             "goto '%s' is not a chain",
+                                             cs.jumpto);
 #endif
                        xtables_find_target(cs.jumpto, XTF_LOAD_MUST_SUCCEED);
                } else {
index 4410a587597ba22481b4c88626266005a41e6438..05661bf6ceee3529f48ebe9ced75a5eb6b3a1559 100644 (file)
@@ -78,8 +78,9 @@ create_handle(const struct iptables_restore_cb *cb, const char *tablename)
        }
 
        if (!handle)
-               xtables_error(PARAMETER_PROBLEM, "%s: unable to initialize "
-                       "table '%s'\n", xt_params->program_name, tablename);
+               xtables_error(PARAMETER_PROBLEM,
+                             "%s: unable to initialize table '%s'",
+                             xt_params->program_name, tablename);
 
        return handle;
 }
@@ -209,8 +210,8 @@ ip46tables_restore_main(const struct iptables_restore_cb *cb,
                        DEBUGP("line %u, table '%s'\n", line, table);
                        if (!table)
                                xtables_error(PARAMETER_PROBLEM,
-                                       "%s: line %u table name invalid\n",
-                                       xt_params->program_name, line);
+                                             "%s: line %u table name invalid",
+                                             xt_params->program_name, line);
 
                        strncpy(curtable, table, XT_TABLE_MAXNAMELEN);
                        curtable[XT_TABLE_MAXNAMELEN] = '\0';
@@ -249,8 +250,8 @@ ip46tables_restore_main(const struct iptables_restore_cb *cb,
                        DEBUGP("line %u, chain '%s'\n", line, chain);
                        if (!chain)
                                xtables_error(PARAMETER_PROBLEM,
-                                          "%s: line %u chain name invalid\n",
-                                          xt_params->program_name, line);
+                                             "%s: line %u chain name invalid",
+                                             xt_params->program_name, line);
 
                        if (strlen(chain) >= XT_EXTENSION_MAXNAMELEN)
                                xtables_error(PARAMETER_PROBLEM,
@@ -263,16 +264,14 @@ ip46tables_restore_main(const struct iptables_restore_cb *cb,
                                        DEBUGP("Flushing existing user defined chain '%s'\n", chain);
                                        if (!cb->ops->flush_entries(chain, handle))
                                                xtables_error(PARAMETER_PROBLEM,
-                                                          "error flushing chain "
-                                                          "'%s':%s\n", chain,
-                                                          strerror(errno));
+                                                             "error flushing chain '%s':%s",
+                                                             chain, strerror(errno));
                                } else {
                                        DEBUGP("Creating new chain '%s'\n", chain);
                                        if (!cb->ops->create_chain(chain, handle))
                                                xtables_error(PARAMETER_PROBLEM,
-                                                          "error creating chain "
-                                                          "'%s':%s\n", chain,
-                                                          strerror(errno));
+                                                             "error creating chain '%s':%s",
+                                                             chain, strerror(errno));
                                }
                        }
 
@@ -280,8 +279,8 @@ ip46tables_restore_main(const struct iptables_restore_cb *cb,
                        DEBUGP("line %u, policy '%s'\n", line, policy);
                        if (!policy)
                                xtables_error(PARAMETER_PROBLEM,
-                                          "%s: line %u policy invalid\n",
-                                          xt_params->program_name, line);
+                                             "%s: line %u policy invalid",
+                                             xt_params->program_name, line);
 
                        if (strcmp(policy, "-") != 0) {
                                struct xt_counters count = {};
@@ -292,8 +291,8 @@ ip46tables_restore_main(const struct iptables_restore_cb *cb,
 
                                        if (!ctrs || !parse_counters(ctrs, &count))
                                                xtables_error(PARAMETER_PROBLEM,
-                                                         "invalid policy counters "
-                                                         "for chain '%s'\n", chain);
+                                                             "invalid policy counters for chain '%s'",
+                                                             chain);
                                }
 
                                DEBUGP("Setting policy of chain %s to %s\n",
@@ -302,10 +301,9 @@ ip46tables_restore_main(const struct iptables_restore_cb *cb,
                                if (!cb->ops->set_policy(chain, policy, &count,
                                                     handle))
                                        xtables_error(OTHER_PROBLEM,
-                                               "Can't set policy `%s'"
-                                               " on `%s' line %u: %s\n",
-                                               policy, chain, line,
-                                               cb->ops->strerror(errno));
+                                                     "Can't set policy `%s' on `%s' line %u: %s",
+                                                     policy, chain, line,
+                                                     cb->ops->strerror(errno));
                        }
 
                        xtables_announce_chain(chain);
index a8dded639cbad1011c64b58e56384cc0b74507da..094adf22b12d20b0ddfb04fe144837ba525fd99b 100644 (file)
@@ -61,8 +61,7 @@ for_each_table(int (*func)(struct iptables_save_cb *cb, const char *tablename),
        while (fgets(tablename, sizeof(tablename), procfile)) {
                if (tablename[strlen(tablename) - 1] != '\n')
                        xtables_error(OTHER_PROBLEM,
-                                  "Badly formed tablename `%s'\n",
-                                  tablename);
+                                     "Badly formed tablename `%s'", tablename);
                tablename[strlen(tablename) - 1] = '\0';
                ret &= func(cb, tablename);
        }
@@ -85,7 +84,7 @@ static int do_output(struct iptables_save_cb *cb, const char *tablename)
                h = cb->ops->init(tablename);
        }
        if (!h)
-               xtables_error(OTHER_PROBLEM, "Cannot initialize: %s\n",
+               xtables_error(OTHER_PROBLEM, "Cannot initialize: %s",
                              cb->ops->strerror(errno));
 
        time_t now = time(NULL);
index 6cf059fb67292d609f15b79ca8269e4896946667..d28cf7481b55df87f0d41a04d212e14c3f29e9b8 100644 (file)
@@ -210,8 +210,8 @@ saveChain(char *chain, char *policy, struct xt_counters *ctr)
 {
        if (nextChain >= maxChains)
                xtables_error(PARAMETER_PROBLEM,
-                          "%s: line %u chain name invalid\n",
-                          prog_name, line);
+                             "%s: line %u chain name invalid",
+                             prog_name, line);
 
        chains[nextChain].chain = xtables_strdup(chain);
        chains[nextChain].policy = xtables_strdup(policy);
@@ -610,8 +610,8 @@ iptables_xml_main(int argc, char *argv[])
                        DEBUGP("line %u, table '%s'\n", line, table);
                        if (!table)
                                xtables_error(PARAMETER_PROBLEM,
-                                          "%s: line %u table name invalid\n",
-                                          prog_name, line);
+                                             "%s: line %u table name invalid",
+                                             prog_name, line);
 
                        openTable(table);
 
@@ -626,8 +626,8 @@ iptables_xml_main(int argc, char *argv[])
                        DEBUGP("line %u, chain '%s'\n", line, chain);
                        if (!chain)
                                xtables_error(PARAMETER_PROBLEM,
-                                          "%s: line %u chain name invalid\n",
-                                          prog_name, line);
+                                             "%s: line %u chain name invalid",
+                                             prog_name, line);
 
                        DEBUGP("Creating new chain '%s'\n", chain);
 
@@ -635,8 +635,8 @@ iptables_xml_main(int argc, char *argv[])
                        DEBUGP("line %u, policy '%s'\n", line, policy);
                        if (!policy)
                                xtables_error(PARAMETER_PROBLEM,
-                                          "%s: line %u policy invalid\n",
-                                          prog_name, line);
+                                             "%s: line %u policy invalid",
+                                             prog_name, line);
 
                        ctrs = strtok(NULL, " \t\n");
                        parse_counters(ctrs, &count);
index 591ec17886562d079f55ced5643c65723e5d85f0..0351b39fb7e3e1b0178d0b10ec648b7974c66bc5 100644 (file)
@@ -761,8 +761,8 @@ int do_command4(int argc, char *argv[], char **table,
 #ifdef IPT_F_GOTO
                        if (cs.fw.ip.flags & IPT_F_GOTO)
                                xtables_error(PARAMETER_PROBLEM,
-                                          "goto '%s' is not a chain\n",
-                                          cs.jumpto);
+                                             "goto '%s' is not a chain",
+                                             cs.jumpto);
 #endif
                        xtables_find_target(cs.jumpto, XTF_LOAD_MUST_SUCCEED);
                } else {
index 608e42a7aa01b2bf4dc585ebf3b6c924cfb6c04b..2403508c684aa2ea27d0ef7a460e9d918edac06c 100644 (file)
@@ -105,7 +105,8 @@ static void mnl_genid_get(struct nft_handle *h, uint32_t *genid)
                return;
 
        xtables_error(RESOURCE_PROBLEM,
-                     "Could not fetch rule set generation id: %s\n", nft_strerror(errno));
+                     "Could not fetch rule set generation id: %s",
+                     nft_strerror(errno));
 }
 
 static int nftnl_table_list_cb(const struct nlmsghdr *nlh, void *data)
index 09cb19c987322f58b75370d1e5857b21b306baa2..b65da371252091dcc6a6b10d5f0956c9430ae75e 100644 (file)
@@ -3857,6 +3857,6 @@ void nft_assert_table_compatible(struct nft_handle *h,
                chain = "";
        }
        xtables_error(OTHER_PROBLEM,
-                     "%s%s%stable `%s' is incompatible, use 'nft' tool.\n",
+                     "%s%s%stable `%s' is incompatible, use 'nft' tool.",
                      pfx, chain, sfx, table);
 }
index 0beacee61d48779af4d374c139afc2028cfdc98a..d400dc595ea992887e4b037d249c9ef00de79dea 100644 (file)
@@ -400,15 +400,15 @@ bool tokenize_rule_counters(char **bufferp, char **pcntp, char **bcntp, int line
 
        ptr = strchr(buffer, ']');
        if (!ptr)
-               xtables_error(PARAMETER_PROBLEM, "Bad line %u: need ]\n", line);
+               xtables_error(PARAMETER_PROBLEM, "Bad line %u: need ]", line);
 
        pcnt = strtok(buffer+1, ":");
        if (!pcnt)
-               xtables_error(PARAMETER_PROBLEM, "Bad line %u: need :\n", line);
+               xtables_error(PARAMETER_PROBLEM, "Bad line %u: need :", line);
 
        bcnt = strtok(NULL, "]");
        if (!bcnt)
-               xtables_error(PARAMETER_PROBLEM, "Bad line %u: need ]\n", line);
+               xtables_error(PARAMETER_PROBLEM, "Bad line %u: need ]", line);
 
        *pcntp = pcnt;
        *bcntp = bcnt;
@@ -433,10 +433,10 @@ void add_argv(struct argv_store *store, const char *what, int quoted)
 
        if (store->argc + 1 >= MAX_ARGC)
                xtables_error(PARAMETER_PROBLEM,
-                             "Parser cannot handle more arguments\n");
+                             "Parser cannot handle more arguments");
        if (!what)
                xtables_error(PARAMETER_PROBLEM,
-                             "Trying to store NULL argument\n");
+                             "Trying to store NULL argument");
 
        store->argv[store->argc] = xtables_strdup(what);
        store->argvattr[store->argc] = quoted;
@@ -900,8 +900,7 @@ static char cmd2char(int option)
                ;
        if (i >= ARRAY_SIZE(cmdflags))
                xtables_error(OTHER_PROBLEM,
-                             "cmd2char(): Invalid command number %u.\n",
-                             1 << i);
+                             "cmd2char(): Invalid command number %u.", 1 << i);
        return cmdflags[i];
 }
 
@@ -911,8 +910,8 @@ static void add_command(unsigned int *cmd, const int newcmd,
        if (invert)
                xtables_error(PARAMETER_PROBLEM, "unexpected '!' flag");
        if (*cmd & (~othercmds))
-               xtables_error(PARAMETER_PROBLEM, "Cannot use -%c with -%c\n",
-                          cmd2char(newcmd), cmd2char(*cmd & (~othercmds)));
+               xtables_error(PARAMETER_PROBLEM, "Cannot use -%c with -%c",
+                             cmd2char(newcmd), cmd2char(*cmd & (~othercmds)));
        *cmd |= newcmd;
 }
 
@@ -979,9 +978,8 @@ static void generic_opt_check(int command, int options)
                        if (!(options & (1<<i))) {
                                if (commands_v_options[j][i] == '+')
                                        xtables_error(PARAMETER_PROBLEM,
-                                                  "You need to supply the `-%c' "
-                                                  "option for this command\n",
-                                                  optflags[i]);
+                                                     "You need to supply the `-%c' option for this command",
+                                                     optflags[i]);
                        } else {
                                if (commands_v_options[j][i] != 'x')
                                        legal = 1;
@@ -991,8 +989,8 @@ static void generic_opt_check(int command, int options)
                }
                if (legal == -1)
                        xtables_error(PARAMETER_PROBLEM,
-                                  "Illegal option `-%c' with this command\n",
-                                  optflags[i]);
+                                     "Illegal option `-%c' with this command",
+                                     optflags[i]);
        }
 }
 
@@ -1060,12 +1058,12 @@ void assert_valid_chain_name(const char *chainname)
 
        if (*chainname == '-' || *chainname == '!')
                xtables_error(PARAMETER_PROBLEM,
-                             "chain name not allowed to start with `%c'\n",
+                             "chain name not allowed to start with `%c'",
                              *chainname);
 
        if (xtables_find_target(chainname, XTF_TRY_LOAD))
                xtables_error(PARAMETER_PROBLEM,
-                             "chain name may not clash with target name\n");
+                             "chain name may not clash with target name");
 
        for (ptr = chainname; *ptr; ptr++)
                if (isspace(*ptr))
index 86177024ec703a652f954d1b79047a1cdae08937..f09883cd518c04a3214b2379a7ee381e0c1cad7c 100644 (file)
@@ -294,7 +294,7 @@ print_zero:
                                              "Multiple commands are not allowed");
                        if (exec_style == EXEC_STYLE_DAEMON)
                                xtables_error(PARAMETER_PROBLEM,
-                                             "%s %s\n", prog_name, prog_vers);
+                                             "%s %s", prog_name, prog_vers);
                        printf("%s %s\n", prog_name, prog_vers);
                        exit(0);
                case 'h':
index 631a3cebf11a77af928fc0fcbcfc021061c79550..c5fc338575f670b8c72e17e672ee0e8442166c49 100644 (file)
@@ -883,7 +883,7 @@ print_zero:
                case 't': /* Table */
                        if (restore && table_set)
                                xtables_error(PARAMETER_PROBLEM,
-                                             "The -t option cannot be used in %s.\n",
+                                             "The -t option cannot be used in %s.",
                                              xt_params->program_name);
                        else if (table_set)
                                xtables_error(PARAMETER_PROBLEM,
index c9d4ffbf8405dde608e82c754e2bd6d3f4cdb307..abe56374289f40a9a3763c9187816d1912afecb2 100644 (file)
@@ -115,14 +115,14 @@ static void xtables_restore_parse_line(struct nft_handle *h,
                DEBUGP("line %u, table '%s'\n", line, table);
                if (!table)
                        xtables_error(PARAMETER_PROBLEM,
-                               "%s: line %u table name invalid\n",
-                               xt_params->program_name, line);
+                                     "%s: line %u table name invalid",
+                                     xt_params->program_name, line);
 
                state->curtable = nft_table_builtin_find(h, table);
                if (!state->curtable)
                        xtables_error(PARAMETER_PROBLEM,
-                               "%s: line %u table name '%s' invalid\n",
-                               xt_params->program_name, line, table);
+                                     "%s: line %u table name '%s' invalid",
+                                     xt_params->program_name, line, table);
 
                if (p->tablename && (strcmp(p->tablename, table) != 0))
                        return;
@@ -152,8 +152,8 @@ static void xtables_restore_parse_line(struct nft_handle *h,
                DEBUGP("line %u, chain '%s'\n", line, chain);
                if (!chain)
                        xtables_error(PARAMETER_PROBLEM,
-                                  "%s: line %u chain name invalid\n",
-                                  xt_params->program_name, line);
+                                     "%s: line %u chain name invalid",
+                                     xt_params->program_name, line);
 
                xtables_announce_chain(chain);
                assert_valid_chain_name(chain);
@@ -162,8 +162,8 @@ static void xtables_restore_parse_line(struct nft_handle *h,
                DEBUGP("line %u, policy '%s'\n", line, policy);
                if (!policy)
                        xtables_error(PARAMETER_PROBLEM,
-                                  "%s: line %u policy invalid\n",
-                                  xt_params->program_name, line);
+                                     "%s: line %u policy invalid",
+                                     xt_params->program_name, line);
 
                if (nft_chain_builtin_find(state->curtable, chain)) {
                        if (counters) {
@@ -172,15 +172,15 @@ static void xtables_restore_parse_line(struct nft_handle *h,
 
                                if (!ctrs || !parse_counters(ctrs, &count))
                                        xtables_error(PARAMETER_PROBLEM,
-                                                  "invalid policy counters for chain '%s'\n",
-                                                  chain);
+                                                     "invalid policy counters for chain '%s'",
+                                                     chain);
 
                        }
                        if (cb->chain_set &&
                            cb->chain_set(h, state->curtable->name,
                                          chain, policy, &count) < 0) {
                                xtables_error(OTHER_PROBLEM,
-                                             "Can't set policy `%s' on `%s' line %u: %s\n",
+                                             "Can't set policy `%s' on `%s' line %u: %s",
                                              policy, chain, line,
                                              strerror(errno));
                        }
@@ -189,13 +189,13 @@ static void xtables_restore_parse_line(struct nft_handle *h,
                } else if (cb->chain_restore(h, chain, state->curtable->name) < 0 &&
                           errno != EEXIST) {
                        xtables_error(PARAMETER_PROBLEM,
-                                     "cannot create chain '%s' (%s)\n",
+                                     "cannot create chain '%s' (%s)",
                                      chain, strerror(errno));
                } else if (h->family == NFPROTO_BRIDGE &&
                           !ebt_cmd_user_chain_policy(h, state->curtable->name,
                                                      chain, policy)) {
                        xtables_error(OTHER_PROBLEM,
-                                     "Can't set policy `%s' on `%s' line %u: %s\n",
+                                     "Can't set policy `%s' on `%s' line %u: %s",
                                      policy, chain, line,
                                      strerror(errno));
                }
index 8174a560ec4df8a3f227affa48a74b221312df36..b16bbfbe323116e2c9201adbce9fcd35236b80fb 100644 (file)
@@ -924,7 +924,7 @@ void xtables_option_tpcall(unsigned int c, char **argv, bool invert,
        cb.entry = xtables_option_lookup(t->x6_options, c);
        if (cb.entry == NULL)
                xtables_error(OTHER_PROBLEM,
-                       "Extension does not know id %u\n", c);
+                             "Extension does not know id %u", c);
        cb.arg      = optarg;
        cb.invert   = invert;
        cb.ext_name = t->name;
@@ -960,7 +960,7 @@ void xtables_option_mpcall(unsigned int c, char **argv, bool invert,
        cb.entry = xtables_option_lookup(m->x6_options, c);
        if (cb.entry == NULL)
                xtables_error(OTHER_PROBLEM,
-                       "Extension does not know id %u\n", c);
+                             "Extension does not know id %u", c);
        cb.arg      = optarg;
        cb.invert   = invert;
        cb.ext_name = m->name;