static void dump_ip(struct ipt_entry *entry)
{
struct ipt_ip *ip = &entry->ip;
+ char ip_string[INET6_ADDRSTRLEN];
+ char ip_mask[INET6_ADDRSTRLEN];
if (strlen(ip->iniface))
connman_info("\tin %s", ip->iniface);
if (strlen(ip->outiface))
connman_info("\tout %s", ip->outiface);
+
+ if (inet_ntop(AF_INET, &ip->src, ip_string, INET6_ADDRSTRLEN) != NULL &&
+ inet_ntop(AF_INET, &ip->smsk,
+ ip_mask, INET6_ADDRSTRLEN) != NULL)
+ connman_info("\tsrc %s/%s", ip_string, ip_mask);
+
+ if (inet_ntop(AF_INET, &ip->dst, ip_string, INET6_ADDRSTRLEN) != NULL &&
+ inet_ntop(AF_INET, &ip->dmsk,
+ ip_mask, INET6_ADDRSTRLEN) != NULL)
+ connman_info("\tdst %s/%s", ip_string, ip_mask);
}
static void dump_target(struct connman_iptables *table,
{.name = "append", .has_arg = 1, .val = 'A'},
{.name = "list", .has_arg = 2, .val = 'L'},
{.name = "new-chain", .has_arg = 1, .val = 'N'},
+ {.name = "destination", .has_arg = 1, .val = 'd'},
{.name = "in-interface", .has_arg = 1, .val = 'i'},
{.name = "jump", .has_arg = 1, .val = 'j'},
{.name = "match", .has_arg = 1, .val = 'm'},
{.name = "out-interface", .has_arg = 1, .val = 'o'},
+ {.name = "source", .has_arg = 1, .val = 's'},
{.name = "table", .has_arg = 1, .val = 't'},
{NULL},
};
int c, ret, in_len, out_len;
size_t size;
gboolean dump, invert;
+ struct in_addr src, dst;
if (argc == 0)
return -EINVAL;
optind = 0;
while ((c = getopt_long(argc, argv,
- "-A:L::N:j:i:m:o:t:", iptables_globals.opts, NULL)) != -1) {
+ "-A:L::N:d:j:i:m:o:s:t:", iptables_globals.opts, NULL)) != -1) {
switch (c) {
case 'A':
chain = optarg;
new_chain = optarg;
break;
+ case 'd':
+ if (!inet_pton(AF_INET, optarg, &dst))
+ break;
+
+ ip.dst = dst;
+ inet_pton(AF_INET, "255.255.255.255", &ip.dmsk);
+
+ break;
+
case 'i':
in_len = strlen(optarg);
break;
+ case 's':
+ if (!inet_pton(AF_INET, optarg, &src))
+ break;
+
+ ip.src = src;
+ inet_pton(AF_INET, "255.255.255.255", &ip.smsk);
+
+ break;
+
case 't':
table_name = optarg;
break;