Add revision support in __add_target
authorMateusz Majewski <m.majewski2@samsung.com>
Thu, 24 Dec 2020 10:46:57 +0000 (11:46 +0100)
committerMateusz Majewski <m.majewski2@samsung.com>
Thu, 14 Jan 2021 12:14:23 +0000 (13:14 +0100)
Change-Id: I7f0c9fa93b783d8de63a633eb6771a11897181d1

src/helper/helper-ip6tables.c
src/helper/helper-iptables.c

index 046428dc1928712a368441fe95a1bcfd7a51c333..a8c429a48b7dd98f5598065b0a0ccf6dd3b9d5e7 100755 (executable)
@@ -93,7 +93,8 @@ static unsigned int __add_match(const char *name, ip6t_entry_match_t *start,
        return match->u.match_size;
 }
 
-static unsigned int __add_target(const char *name, ip6t_entry_target_t *start, size_t size, void *data)
+static unsigned int __add_target(const char *name, ip6t_entry_target_t *start,
+                                                                               int revision, size_t size, void *data)
 {
        ip6t_entry_target_t *target = start;
 
@@ -101,6 +102,7 @@ static unsigned int __add_target(const char *name, ip6t_entry_target_t *start, s
 
        g_strlcpy(target->u.user.name, name, XT_EXTENSION_MAXNAMELEN);
        memcpy(target->data, data, size);
+       target->u.user.revision = revision;
 
        return target->u.target_size;
 }
@@ -280,7 +282,7 @@ static unsigned int __add_log_target(unsigned char level, const char *prefix,
        log.level = level;
        g_strlcpy(log.prefix, prefix, 30);
        /* target_log */
-       return __add_target(IP6TC_LOG, start, sizeof(ip6t_log_info_t), &log);
+       return __add_target(IP6TC_LOG, start, 0, sizeof(ip6t_log_info_t), &log);
 }
 
 static unsigned int __add_nflog_target(unsigned int group, const char *prefix,
@@ -294,7 +296,7 @@ static unsigned int __add_nflog_target(unsigned int group, const char *prefix,
        nflog.len = range;
        nflog.threshold = threshold;
        /* target_nflog */
-       return __add_target(IP6TC_NFLOG, start, sizeof(ip6t_nflog_info_t), &nflog);
+       return __add_target(IP6TC_NFLOG, start, 0, sizeof(ip6t_nflog_info_t), &nflog);
 }
 
 static int __create_entry_data(unsigned char *entry, unsigned char *mask,
index 8678ba6c7ac85bd3fc71ea3e79d4a8ef91d7fb86..e4cc3ae8281e5bcbe25d3aa2265865601abbe3a2 100755 (executable)
@@ -92,7 +92,8 @@ static unsigned int __add_match(const char *name, ipt_entry_match_t *start,
        return match->u.match_size;
 }
 
-static unsigned int __add_target(const char *name, ipt_entry_target_t *start, size_t size, void *data)
+static unsigned int __add_target(const char *name, ipt_entry_target_t *start,
+                                                                               int revision, size_t size, void *data)
 {
        ipt_entry_target_t *target = start;
 
@@ -100,6 +101,7 @@ static unsigned int __add_target(const char *name, ipt_entry_target_t *start, si
 
        g_strlcpy(target->u.user.name, name, XT_EXTENSION_MAXNAMELEN);
        memcpy(target->data, data, size);
+       target->u.user.revision = revision;
 
        return target->u.target_size;
 }
@@ -279,7 +281,7 @@ static unsigned int __add_log_target(unsigned char level, const char *prefix,
        log.level = level;
        g_strlcpy(log.prefix, prefix, 30);
        /* target_log */
-       return __add_target(IPTC_LOG, start, sizeof(ipt_log_info_t), &log);
+       return __add_target(IPTC_LOG, start, 0, sizeof(ipt_log_info_t), &log);
 }
 
 static unsigned int __add_nflog_target(unsigned int group, const char *prefix,
@@ -293,7 +295,7 @@ static unsigned int __add_nflog_target(unsigned int group, const char *prefix,
        nflog.len = range;
        nflog.threshold = threshold;
        /* target_nflog */
-       return __add_target(IPTC_NFLOG, start, sizeof(ipt_nflog_info_t), &nflog);
+       return __add_target(IPTC_NFLOG, start, 0, sizeof(ipt_nflog_info_t), &nflog);
 }
 
 static int __create_entry_data(unsigned char *entry, unsigned char *mask,