[tor-bugs] #27224 [Core Tor/Tor]: Call node_get_all_orports() less from node_is_a_configured_bridge()

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Aug 27 01:03:07 UTC 2018


#27224: Call node_get_all_orports() less from node_is_a_configured_bridge()
-------------------------------------------------+-------------------------
 Reporter:  nickm                                |          Owner:  rl1987
     Type:  defect                               |         Status:
                                                 |  needs_revision
 Priority:  Medium                               |      Milestone:  Tor:
                                                 |  0.3.5.x-final
Component:  Core Tor/Tor                         |        Version:
 Severity:  Normal                               |     Resolution:
 Keywords:  035-roadmap-master, 035-triaged-     |  Actual Points:
  in-20180711                                    |
Parent ID:  #26630                               |         Points:
 Reviewer:                                       |        Sponsor:
                                                 |  Sponsor8
-------------------------------------------------+-------------------------
Changes (by teor):

 * status:  needs_review => needs_revision


Comment:

 This branch fails Linux gcc with:
 {{{
 gcc -std=gnu99 -DHAVE_CONFIG_H -I.  -I./src -I./src/ext
 -I./src/ext/trunnel -I./src/trunnel -I./src/ext -Isrc/ext
 -DSHARE_DATADIR="\"/usr/local/share\""
 -DLOCALSTATEDIR="\"/usr/local/var\"" -DBINDIR="\"/usr/local/bin\""
 -DTOR_UNIT_TESTS  -DHAVE_MODULE_DIRAUTH=1  -ftrapv -fsanitize=address
 -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all
 -Wstack-protector --param ssp-buffer-size=1 -fPIE -fno-omit-frame-pointer
 -fasynchronous-unwind-tables -Wall -fno-strict-aliasing -Waddress -Warray-
 bounds -Wdouble-promotion -Wextra -Winit-self -Wlogical-op -Wmissing-
 field-initializers -Wmissing-format-attribute -Wmissing-noreturn
 -Wnormalized=nfkc -Woverlength-strings -Woverride-init -Wshadow -Wstrict-
 overflow=1 -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wsync-
 nand -Wtrampolines -Wunused-but-set-parameter -Wunused-but-set-variable
 -Wunused-local-typedefs -Wvariadic-macros -W -Wfloat-equal -Wundef
 -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings
 -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat=2 -Wwrite-strings
 -Wnested-externs -Wbad-function-cast -Wswitch-enum -Waggregate-return
 -Wpacked -Wunused -Wunused-parameter  -Wold-style-definition -Wmissing-
 declarations -Werror -MT src/feature/dircache
 /src_core_libtor_app_testing_a-directory.o -MD -MP -MF
 src/feature/dircache/.deps/src_core_libtor_app_testing_a-directory.Tpo -c
 -o src/feature/dircache/src_core_libtor_app_testing_a-directory.o `test -f
 'src/feature/dircache/directory.c' || echo
 './'`src/feature/dircache/directory.c
 src/feature/client/bridges.c: In function
 ‘bridge_exists_with_ipv4h_addr_and_port’:
 src/feature/client/bridges.c:291:3: error: missing initializer for field
 ‘family’ of ‘tor_addr_t’ [-Werror=missing-field-initializers]
    tor_addr_t node_ipv4 = {};
    ^
 In file included from ./src/core/or/or.h:51:0,
                  from src/feature/client/bridges.c:16:
 ./src/lib/net/address.h:69:15: note: ‘family’ declared here
    sa_family_t family;
                ^
 cc1: all warnings being treated as errors
 }}}

 I believe the correct syntax for zero-initialising any number of struct
 members is:
 {{{
   tor_addr_t node_ipv4 = {0};
 }}}

 But it's slightly more correct to do:
 {{{
   tor_addr_t node_ipv4;
   tor_addr_make_unspec(&node_ipv4, AF_INET);
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/27224#comment:4>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list