bufbuild / protovalidate-cc

Protocol Buffer Validation for C++.
https://buf.build/bufbuild/protovalidate
Apache License 2.0
13 stars 4 forks source link

Add isIpPrefix #45

Closed paina closed 10 months ago

paina commented 11 months ago

Related to: https://github.com/bufbuild/protovalidate/pull/99

Based on @higebu's idea on the PR, I've implemented isIpPrefix() for C++.

CLAassistant commented 11 months ago

CLA assistant check
All committers have signed the CLA.

rodaine commented 10 months ago

@paina looks like there's still some wiring missing to define the CEL functions. Want to take a stab it?

rodaine commented 10 months ago

Getting an error running the conformance tests locally on MacOS Sonoma:

→ make conformance
GOBIN=/Users/rodaine/src/github.com/bufbuild/protovalidate-cc/.tmp/bin go install \
        github.com/bufbuild/protovalidate/tools/protovalidate-conformance@v0.5.1
bazel build -c opt //buf/validate/conformance:runner_main && \
.tmp/bin/protovalidate-conformance bazel-bin/buf/validate/conformance/runner_main --strict
INFO: Analyzed target //buf/validate/conformance:runner_main (24 packages loaded, 177 targets configured).
INFO: Found 1 target...
ERROR: /Users/rodaine/src/github.com/bufbuild/protovalidate-cc/buf/validate/internal/BUILD.bazel:103:11: Compiling buf/validate/internal/extra_func.cc failed: (Exit 1): cc_wrapper.sh failed: error executing command (from target //buf/validate/internal:extra_func) external/local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fcolor-diagnostics ... (remaining 65 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
buf/validate/internal/extra_func.cc:299:14: error: no member named '__in6_u' in 'in6_addr'
        mask.__in6_u.__u6_addr32[i] = htonl(0xffffffff);
        ~~~~ ^
buf/validate/internal/extra_func.cc:301:14: error: no member named '__in6_u' in 'in6_addr'
        mask.__in6_u.__u6_addr32[i] = htonl(std::pow(2, 32*(i+1) - prefixlen_int) - 1);
        ~~~~ ^
buf/validate/internal/extra_func.cc:303:14: error: no member named '__in6_u' in 'in6_addr'
        mask.__in6_u.__u6_addr32[i] = htonl(0);
        ~~~~ ^
buf/validate/internal/extra_func.cc:307:29: error: no member named '__in6_u' in 'in6_addr'
      if ((sa_six.sin6_addr.__in6_u.__u6_addr32[i] & mask.__in6_u.__u6_addr32[i]) != 0) {
           ~~~~~~~~~~~~~~~~ ^
buf/validate/internal/extra_func.cc:307:59: error: no member named '__in6_u' in 'in6_addr'
      if ((sa_six.sin6_addr.__in6_u.__u6_addr32[i] & mask.__in6_u.__u6_addr32[i]) != 0) {
                                                     ~~~~ ^
5 errors generated.
Target //buf/validate/conformance:runner_main failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 4.636s, Critical Path: 4.26s
INFO: 12 processes: 8 internal, 4 darwin-sandbox.
FAILED: Build did NOT complete successfully
Makefile:46: *** [conformance] error 1

#0  conformance at /Users/rodaine/src/github.com/bufbuild/protovalidate-cc/Makefile:45