]> jfr.im git - irc/quakenet/snircd.git/blame - doc/readme.crules
Merged revisions 59-76 via svnmerge from
[irc/quakenet/snircd.git] / doc / readme.crules
CommitLineData
189935b1 1SmartRoute
2Rule based connects
3Draft 4 - Aug 19, 1994
4by Tony Vencill
5
6Rule based connects allow an admin to specify under what conditions
7a connect should not be allowed. If no rules are specified for a
8given C and/or N line it will be allowed under any condition.
9
10A rule may consist of any legal combination of the following functions
11and operators.
12
13Functions
14---------
15connected(targetmask) - true if a server other than that processing
16 the rule is connected that matches the
17 target mask
18directcon(targetmask) - true if a server other than that processing
19 the rule is directly connected that matches
20 the target mask
21via(viamask, targetmask) - true if a server other than that processing
22 the rule matches the target mask and is
23 connected via a directly connected server
24 that matches the via mask
25directop() - true if an oper is directly connected
26
27Unary operators
28---------------
29! eg: !argument - true if the argument is false
30
31Binary operartors
32-----------------
33&& eg: arg1&&arg2 - true if arg1 and arg2 are both true
34|| eg: arg1||arg2 - true if arg1, arg2, or both are true
35
36Parenthesis () are allowed for grouping arguments, but if no parenthesis
37are included, && will take precedence over ||, ! will take precedence
38over both && and ||, and the function will be evaluated from left to
39right. White space in a rule is ignored. Invalid characters in a rule
40will lead to the rule being ignored.
41
42Examples
43--------
44
45A simple example of a connect rule might be:
46
47connected(*eu.under*)
48
49This might be used in a US undernet server for a Europe CN pair to
50insure that a second Europe link is not allowed if one US-EU link
51already exists. Note that on the undernet, US server names are
52city.state.us.undernet.org and Europe server names are
53city.country.eu.undernet.org.
54
55A more interesting example might be:
56
57connected(*eu.under*) &&
58 ( !direct(*eu.under*) || via(manhat*, *eu.under*) )
59
60Imagine the Boston undernet server uses this rule on its Europe CN
61pairs. This says that if a Europe server is already connected, a
62Boston-Europe connect will not be allowed. It also says that if a
63Europe server does already exist and Boston is not directly connected
64to one or more Europe servers or Manhattan is, the Boston-Europe
65connect will not be allowed. This has the effect of allowing multiple
66US-EU links but attempting to limit these links to one server (ie:
67Boston will not initiate its first Europe link if another server is
68already linking Europe). This rule will also prefer to let Manhattan
69handle the US-EU link by disallowing Boston-Europe links if a Europe
70server is already linked to Manhattan.
71
72A example of the remaining function, directop(), is:
73
74connected(*eu.under*) || directop()
75
76If this line is used on Boston for the Paderborn CN pair, it will allow
77connects to Paderborn only if another Europe server is not already
78connected and there is not an oper on Boston. If this rule is
79overrideable (ie: is applied only to autoconnects as described below),
80then it will disallow Boston autoconnects to Paderborn while a Boston
81oper is online, but allow oper-initiated connects to Paderborn under any
82circumstance. This directop() function could be used to invoke less
83prefered routes only when an oper is not present to handle routing, or
84conversly to allow use of less preferable routes only when an oper is
85present to monitor their performance.
86
87ircd.conf entries
88-----------------
89
90A rule is listed in the ircd.conf file using a D or d line (which can
91be thought of as a "disallow" line). D lines will apply to all oper
92and server originated connects, while d lines will apply only to
93autoconnects (ie: they are overrideable by opers). The formats are:
94
95D:targetmask::rule
96d:targetmask::rule
97
98Remember that newlines are not allowed in conf lines. Two examples
99(from above) are:
100
101D:*eu.under*::connected(*eu.under*)
102d:*eu.under*::connected(*eu.under*) || directop()
103
104Connects originating from other servers will be checked against and
105matching D lines, while matching d lines will be ignored as it will not
106be clear whether or not the connection attempt is oper initiated.
107
108Checking and viewing rules
109--------------------------
110
111The chkconf program that comes with the servers has been modified to
112also check your connect rules. If running in debug mode, parsing errors
113will show up at debug level 8. To view rules online, "/stats d" can be
114used to see all rules and "/stats D" can be used to view those rules
115which affect oper initiated connects and accepts.
116
117Processing and storage
118----------------------
119
120The rules are parsed when the conf file is read and transformed into a
121more efficiently computed form, then all applicable rules are
122evaluated each time a connect command is given or an autoconnect is
123due. If more than one applicable rule is given, only one need
124evaluate to true for the connect to be allowed (ie: the rules are ored
125together). Note that conditions that exist when the connect is
126initiated might differ from conditions when the link is established.