~ubuntu-branches/ubuntu/trusty/xtables-addons/trusty

« back to all changes in this revision

Viewing changes to extensions/ipset-6/libipset/print.c

  • Committer: Package Import Robot
  • Author(s): Pierre Chifflier, Pierre Chifflier, Dmitry Smirnov
  • Date: 2011-12-05 22:10:25 UTC
  • mfrom: (1.3.6)
  • Revision ID: package-import@ubuntu.com-20111205221025-ogq3g7zsm912lmsh
Tags: 1.40-1
[ Pierre Chifflier ]
* Add patch to avoid calling depmod during build
* Add VCS links
* Change license for packaging files to GPL-2+ (with agreement of all
  authors).
* Add Dmitry Smirnov as co-maintainer
  - Merge all changes
* Imported Upstream version 1.40 (2011-11-30)
  Fixes:
  - build: the code actually requires at least iptables 1.4.5
    (would yield a compile error otherwise), make sure configure
    checks for it; update INSTALL
  - xt_ECHO: fix kernel warning about RTAX_HOPLIMIT being used
  - xt_ipv4options: fix an infinite loop
  Changes:
  - xt_ECHO: now calculates UDP checksum
  - Linux kernel versions below 2.6.32 are no longer officially
    supported, and will not be part of compilation testing.
  - update to ipset 6.10
  Enhancements:
  - xt_ECHO: IPv6 support

[Dmitry Smirnov] <onlyjob@member.fsf.org>
* Major repackaging (Closes: #638061)
  * Obsolete ipset_v4 replaced with new ipset_v6 (Closes: #648083)
  * debian/copyright updated for DEP5 compatibility
  * debian/control updated
    - Standards version update
    - Depends update
    - Build-depends tightening
  * debian/watch fixed
  * debian/rules rewrite
    - get-orig-source target added
    - build-time cleanup (make clean) is fixed
    - second build do not fail
    - offload most tasks to debhelper (with minimum overrides)
    - standalone debian/rules for xtables-addons-source
    - using CFLAGS/Hardening if provided by DPKG
    - dynamically prepare DKMS config during build
    - configure for Kbuild only if headers available
  * lintianization
    - override for package-name-doesnt-match-sonames
  * DKMS package cleanup
    - broken post-init script removed
    - only clean source is packaged
    - improved configuration
  * source package cleanup
    - module-assistant rules use debhelper more
    - using CFLAGS if provided by DPKG
  * lintian override
  * DKMS config sanitation (all argument in double quotes)
  * patch to avoid build-time depmod invocation
* Imported Upstream version 1.39 (2011-09-21)
  - libxt_ACCOUNT: fix compilation after missing libxtables_CFLAGS
  - build: fix compilation after missing libxtables_CFLAGS in submodules
  - build: add missing linux/version.h includes where needed
  - Remove unsupported ipset 4.x from the Xtables-addons distribution
  - ipset: move ipset_errcode from src to library to avoid undefined reference
  - update to ipset 6.9.1
  - xt_CHECKSUM: abort build when the feature is already provided by mainline
  - xt_SYSRQ: fix UDPLITE header lookup in IPv6
  - xt_TARPIT: fix kernel warning about RTAX_HOPLIMIT being used
  - xt_TEE: abort build when the feature is already provided by mainline
  - xt_ipp2p: support UDPLITE
  - xt_pknock: support UDPLITE
  - xt_psd: restore functionality with UDP
  - xt_psd: support UDPLITE
  - support for Linux 3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
152
152
 
153
153
        memset(&saddr, 0, sizeof(saddr));
154
154
        in4cpy(&saddr.sin_addr, &addr->in);
155
 
        saddr.sin_family = AF_INET;
 
155
        saddr.sin_family = NFPROTO_IPV4;
156
156
 
157
157
        err = getnameinfo((const struct sockaddr *)&saddr,
158
158
                          sizeof(saddr),
178
178
 
179
179
        memset(&saddr, 0, sizeof(saddr));
180
180
        in6cpy(&saddr.sin6_addr, &addr->in6);
181
 
        saddr.sin6_family = AF_INET6;
 
181
        saddr.sin6_family = NFPROTO_IPV6;
182
182
 
183
183
        err = getnameinfo((const struct sockaddr *)&saddr,
184
184
                          sizeof(saddr),
253
253
                cidr = *(const uint8_t *) ipset_data_get(data, cidropt);
254
254
                D("CIDR: %u", cidr);
255
255
        } else
256
 
                cidr = family == AF_INET6 ? 128 : 32;
 
256
                cidr = family == NFPROTO_IPV6 ? 128 : 32;
257
257
        flags = (env & IPSET_ENV_RESOLVE) ? 0 : NI_NUMERICHOST;
258
258
 
259
259
        ip = ipset_data_get(data, opt);
260
260
        assert(ip);
261
 
        if (family == AF_INET)
 
261
        if (family == NFPROTO_IPV4)
262
262
                size = snprintf_ipv4(buf, len, flags, ip, cidr);
263
 
        else if (family == AF_INET6)
 
263
        else if (family == NFPROTO_IPV6)
264
264
                size = snprintf_ipv6(buf, len, flags, ip, cidr);
265
265
        else
266
266
                return -1;
275
275
        SNPRINTF_FAILURE(size, len, offset);
276
276
 
277
277
        ip = ipset_data_get(data, IPSET_OPT_IP_TO);
278
 
        if (family == AF_INET)
 
278
        if (family == NFPROTO_IPV4)
279
279
                size = snprintf_ipv4(buf + offset, len, flags, ip, cidr);
280
 
        else if (family == AF_INET6)
 
280
        else if (family == NFPROTO_IPV6)
281
281
                size = snprintf_ipv6(buf + offset, len, flags, ip, cidr);
282
282
        else
283
283
                return -1;
320
320
        if (ipset_data_test(data, cidropt))
321
321
                cidr = *(const uint8_t *) ipset_data_get(data, cidropt);
322
322
        else
323
 
                cidr = family == AF_INET6 ? 128 : 32;
 
323
                cidr = family == NFPROTO_IPV6 ? 128 : 32;
324
324
        flags = (env & IPSET_ENV_RESOLVE) ? 0 : NI_NUMERICHOST;
325
325
 
326
326
        ip = ipset_data_get(data, opt);
327
327
        assert(ip);
328
 
        if (family == AF_INET)
 
328
        if (family == NFPROTO_IPV4)
329
329
                return snprintf_ipv4(buf, len, flags, ip, cidr);
330
 
        else if (family == AF_INET6)
 
330
        else if (family == NFPROTO_IPV6)
331
331
                return snprintf_ipv6(buf, len, flags, ip, cidr);
332
332
 
333
333
        return -1;
705
705
        if (!type)
706
706
                return -1;
707
707
 
708
 
        size = type->elem[IPSET_DIM_ONE].print(buf, len, data,
709
 
                        type->elem[IPSET_DIM_ONE].opt, env);
 
708
        size = type->elem[IPSET_DIM_ONE - 1].print(buf, len, data,
 
709
                        type->elem[IPSET_DIM_ONE - 1].opt, env);
710
710
        SNPRINTF_FAILURE(size, len, offset);
711
 
        IF_D(ipset_data_test(data, type->elem[IPSET_DIM_TWO].opt),
 
711
        IF_D(ipset_data_test(data, type->elem[IPSET_DIM_TWO - 1].opt),
712
712
             "print second elem");
713
713
        if (type->dimension == IPSET_DIM_ONE ||
714
714
            (type->last_elem_optional &&
715
 
             !ipset_data_test(data, type->elem[IPSET_DIM_TWO].opt)))
 
715
             !ipset_data_test(data, type->elem[IPSET_DIM_TWO - 1].opt)))
716
716
                return offset;
717
717
 
718
718
        size = snprintf(buf + offset, len, IPSET_ELEM_SEPARATOR);
719
719
        SNPRINTF_FAILURE(size, len, offset);
720
 
        size = type->elem[IPSET_DIM_TWO].print(buf + offset, len, data,
721
 
                        type->elem[IPSET_DIM_TWO].opt, env);
 
720
        size = type->elem[IPSET_DIM_TWO - 1].print(buf + offset, len, data,
 
721
                        type->elem[IPSET_DIM_TWO - 1].opt, env);
722
722
        SNPRINTF_FAILURE(size, len, offset);
723
723
        if (type->dimension == IPSET_DIM_TWO ||
724
724
            (type->last_elem_optional &&
725
 
             !ipset_data_test(data, type->elem[IPSET_DIM_THREE].opt)))
 
725
             !ipset_data_test(data, type->elem[IPSET_DIM_THREE - 1].opt)))
726
726
                return offset;
727
727
 
728
728
        size = snprintf(buf + offset, len, IPSET_ELEM_SEPARATOR);
729
729
        SNPRINTF_FAILURE(size, len, offset);
730
 
        size = type->elem[IPSET_DIM_THREE].print(buf + offset, len, data,
731
 
                        type->elem[IPSET_DIM_THREE].opt, env);
 
730
        size = type->elem[IPSET_DIM_THREE - 1].print(buf + offset, len, data,
 
731
                        type->elem[IPSET_DIM_THREE - 1].opt, env);
732
732
        SNPRINTF_FAILURE(size, len, offset);
733
733
 
734
734
        return offset;