Commit Graph

194 Commits

Author SHA1 Message Date
Nick Mathewson
f3330d2be3 Make "invisibility" and "undumpability" properties of variables.
Previously, these were magical things that we detected by checking
whether a variable's name was prefixed with two or three underscores.
2019-06-25 12:51:25 -04:00
Nick Mathewson
a7835202cf Turn several properties of types or variables into flags.
"unsettable" is a property of types.  LINELIST_V and OBSOLETE are
unsettable, meaning that they cannot be set by name.

"contained" is a property of types.  I'm hoping to find a better
name here.  LINELIST_S is "contained" because it always appears
within a LINELIST_V, and as such doesn't need to be dumped ore
copied independently.

"cumulative" is a property of types. Cumulative types can appear
more than once in a torrc without causing a warning, because they
add to each other rather than replacing each other.

"obsolete" is a property of variables.

"marking fragile" is now a command that struct members can accept.

With these changes, confparse and config no longer ever need to
mention CONFIG_TYPE_XYZ values by name.
2019-06-25 12:51:25 -04:00
Nick Mathewson
b6457d4c08 Extend macros to allow flag arguments. 2019-06-25 12:51:25 -04:00
Nick Mathewson
c553750e32 Move responsibility for config var macros
The testing-only parts now live in a conftesting.h; the shared parts
of the macros live in confmacros.h
2019-06-25 12:51:25 -04:00
Nick Mathewson
4d101b39d7 Move config_var_t info conftypes.h 2019-06-25 12:51:25 -04:00
Nick Mathewson
a114df9a04 Add a function to make sure all values in a config object are ok 2019-06-25 12:51:25 -04:00
Nick Mathewson
a91ed23403 Use structvar to find the types for config vars. 2019-06-25 12:51:25 -04:00
Nick Mathewson
53e969c137 Use struct_var_{copy,eq} in confparse.c. 2019-06-25 12:51:25 -04:00
Nick Mathewson
59317c8a23 Use struct_magic_decl to verify magic numbers in config objects 2019-06-25 12:51:25 -04:00
Nick Mathewson
3a4d67cf45 Port confparse to use struct_var in place of typed_var.
This requires changes to config_var_t, causing corresponding changes
throughout its users.
2019-06-25 12:51:25 -04:00
Nick Mathewson
e16b90b88a Partially port routerset to being a full-fledged config type again. 2019-06-24 17:52:00 -04:00
Nick Mathewson
c60a85d22a Add a "typed_var" abstraction to implement lvalue access in C.
Right now, this has been done at a high level by confparse.c, but it
makes more sense to lower it.

This API is radically un-typesafe as it stands; we'll be wrapping it
in a safer API as we do #30914 and lower the struct manipulation
code as well.

Closes ticket 30864.
2019-06-24 17:50:43 -04:00
Nick Mathewson
458da8a80d Move unit-parsing code to src/lib/confmgt
lib/confmgt is at a higher level than lib/conf, since it needs to
call down to logging and similar modules.
2019-06-24 15:11:57 -04:00
Nick Mathewson
246599abb4 Start moving types that will be used for config vars to lib/conf
This will be a lower-level module than anything that actually
sets or handles configuration variables.

Part of 30864.
2019-06-24 15:11:57 -04:00
David Goulet
e6579d801f Merge branch 'tor-github/pr/1113' 2019-06-19 07:47:03 -04:00
Nick Mathewson
52d386c9b0 Merge remote-tracking branch 'tor-github/pr/1100' 2019-06-17 08:54:12 -04:00
Nick Mathewson
7c6cc470f1 Merge branch 'bug30894_035' into ticket30893 2019-06-15 16:50:02 -04:00
Nick Mathewson
26436fb1b6 Add more unit tests for confparse.c, so we can refactor.
This set of tests gets the line coverage to 100%.
2019-06-15 16:49:18 -04:00
Nick Mathewson
4ab1d1c0c4 Fix memleak when failing to parse a CSV_INTERVAL.
Fixes bug 30894; bugfix on 0.3.4.1-alpha
2019-06-15 16:47:16 -04:00
Nick Mathewson
fe9d15cf4b Remove the PORT configuration type: nothing uses it.
All of our port configurations now use an extended format.
2019-06-15 11:30:24 -04:00
Nick Mathewson
ac5e44d9ce Renaming: CONFIG_TYPE_UINT -> CONFIG_TYPE_POSINT
This name has been a historical source of confusion, since "uint"
usually suggests "unsigned int" to people, when the real type is
"nonnegative int".
2019-06-15 11:28:19 -04:00
George Kadianakis
319ce22581 Merge branch 'bug30806' 2019-06-14 13:28:32 +03:00
Nick Mathewson
990b434c4f Make evloop into a subsystem.
Note that the event base object is _not_ created from the initialize
function, since it is configuration-dependent.  This will wait until
configuration is integrated into subsystems.

Closes ticket 30806.
2019-06-14 13:28:10 +03:00
David Goulet
f7e8b3b68c Merge branch 'tor-github/pr/1040' 2019-06-11 11:59:39 -04:00
Taylor Yu
0bce0c339d Rework origin circuit tracking to use pubsub
Part of ticket 29976.
2019-06-11 11:59:30 -04:00
Taylor Yu
a8c0f4ddfe Rework orconn tracking to use pubsub
Part of ticket 29976.
2019-06-11 11:59:30 -04:00
David Goulet
8e112cecd8 Merge branch 'tor-github/pr/1031' 2019-06-11 11:46:38 -04:00
George Kadianakis
eab9dc06af Merge branch 'tor-github/pr/1065' into maint-0.4.1 2019-06-11 13:48:10 +03:00
Xiaoyin Liu
024d65e14e
Free a string buffer in nt_service_install()
The string buffer "command" is not freed if the specified account
name doesn't exist. This patch fixes this bug.
2019-06-11 15:12:20 +10:00
Nick Mathewson
60213a3621 Run "make autostyle." 2019-06-05 09:33:35 -04:00
Nick Mathewson
fd8beab4dd Merge branch 'bug29875_035' into bug29875_master 2019-05-31 12:40:43 -04:00
Nick Mathewson
5b3c886584 Consider dir info to have changed when the bridges change
Otherwise, we won't realize that we haven't got enough bridge
information to build circuits.  Part of a fix for ticket 29875.
2019-05-31 12:27:42 -04:00
Nick Mathewson
70b85358af Fix a logic error in deciding whether to accept SessionGroup=
Fixes bug 22619; bugfix on 0.2.7.2-alpha
2019-05-31 08:26:10 -04:00
Nick Mathewson
ba9b0319b0 Shutdown libevent _after_ the subsystems.
This is necessary since shutting down libevent frees some pointer
that the subsystems want to free themselves. A longer term solution
will be to turn the evloop module into a subsystem itself, but for
now it is best to do the minimal fix.

Fixes bug 30629; bugfix on 0.4.1.1-alpha.
2019-05-29 11:25:47 -04:00
Iain R. Learmonth
58cb98af32 Prop 301: No longer vote on RecommendedPackages
This is the first half of implementing proposal 301. The
RecommendedPackages torrc option is marked as obsolete and
the test cases for the option removed. Additionally, the code relating
to generating and formatting package lines in votes is removed.

These lines may still appear in votes from other directory authorities
running earlier versions of the code and so consensuses may still
contain package lines. A new consensus method will be needed to stop
including package lines in consensuses.

Fixes: #28465
2019-05-16 13:31:54 +01:00
George Kadianakis
69a277f635 Introduce circpad free_all() function. 2019-05-16 14:07:25 +03:00
George Kadianakis
338cfb3179 Merge branch 'tor-github/pr/1002' 2019-05-15 23:23:18 +03:00
Nick Mathewson
370ea8d23b Merge branch 'ticket30452_035_v3' into ticket30452_041_v3 2019-05-14 19:55:51 -04:00
Nick Mathewson
0c451b31d2 Make --list-modules imply --hush 2019-05-14 19:55:35 -04:00
Nick Mathewson
1c95bdb83b Merge branch 'ticket30452_035_v3' into ticket30452_041_v3 2019-05-14 19:20:53 -04:00
Nick Mathewson
1b16fcb70c Add a --list-modules command
Closes ticket 30452.
2019-05-14 19:19:53 -04:00
Nick Mathewson
9ad2eb8f73 Merge branch 'bug28683_30173_29203_squashed' 2019-05-13 14:33:31 -04:00
Mike Perry
621ea2315b Bug 29203: Provide ReducedCircuitPadding torrc and consensus params 2019-05-13 14:30:35 -04:00
Mike Perry
f4064d6ce2 Bug 28693: Provide Torrc option to disable circuit padding. 2019-05-13 14:30:35 -04:00
Nick Mathewson
3c2648bbda Move "relay" and "router" periodic callbacks out of mainloop.c
(Some of these callbacks are specific to the OR module, so now it's
time to have an or_sys and or_periodic.)
2019-05-06 16:35:39 -04:00
Nick Mathewson
b394b5b2af Create a relay subsystem and move the shutdown functions there 2019-05-06 16:25:09 -04:00
Nick Mathewson
9c3aa22740 Remove some now-needless dirauth includes 2019-05-02 09:22:13 -04:00
Nick Mathewson
a45413e7d5 Make keypin.c dirauth-only 2019-05-02 09:22:13 -04:00
Nick Mathewson
31fb4a7845 Make the bwauth.c module dirauth-only. 2019-05-02 09:22:13 -04:00
Nick Mathewson
339ac4dc67 Make the guardfraction.c module dirauth-only. 2019-04-30 15:00:08 -04:00