1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-26 05:56:38 +02:00
Commit Graph

703 Commits

Author SHA1 Message Date
Bram Matthys 4e53bf874a Make remote includes caching work again. Both on-boot and on-rehash. 2021-08-19 09:33:46 +02:00
Bram Matthys 7b3c1165f8 Make tld::mask use the generic masks that we use everywhere
(and hence support multiple masks and server bans matching etc)
2021-08-18 18:45:23 +02:00
Bram Matthys e503ad4fd5 Reorder members in ConfigEntry struct a bit (optimize for L1/L2 cache)
Obviously name, value and next should be at the top.
2021-08-18 18:32:05 +02:00
Bram Matthys a60b9f3176 Handle duplicate URLs/downloads (only download once) 2021-08-18 16:43:42 +02:00
Bram Matthys ce3e23a5d2 Get rid of unnecessary included_from and included_from_line
members in ConfigResource (previously ConfigItem_include).
2021-08-18 16:31:48 +02:00
Bram Matthys 756fee58cb Rename ConfigItem_include to ConfigResource and also use it for non-includes
such as other items in the configuration file that are URLs.
2021-08-18 14:54:41 +02:00
Bram Matthys b74d15595b Change int rehash() to void request_rehash(), which is a better name
as it REQUESTS to rehash the server, but it may not be done immediately.
And making it void makes sure nobody relies on some sort of return
value which will differ between with vs without remote includes.

Also get rid of sig and loop.rehash_save_sig, as a NULL client
already indicates the same (or at least does so now).
2021-08-18 13:28:56 +02:00
Bram Matthys 675c1cab55 Rename loop struct members:
* loop.ircd_rehashing -> loop.rehashing
* loop.ircd_terminating -> loop.terminating
* loop.ircd_booted -> loop.booted
* loop.ircd_forked -> loop.forked
2021-08-18 13:08:42 +02:00
Bram Matthys 7321a66196 Make failed include loading fatal again. And fix a crash related to that. 2021-08-18 12:46:11 +02:00
Bram Matthys 685e0ee073 In ConfigItem_include include->url now always exists, and src/url.c is now
always compiled in, both regardless of cURL support or not.
Obviously the cURL functions are not available without cURL and there
are now some #ifdef USE_LIBCURL in url.c

This also fixes the current build to work without cURL
2021-08-18 12:27:13 +02:00
Bram Matthys 03423a2eb7 Get rid of INCLUDE_NOTLOADED and INCLUDE_USED which AFAICT are
unnecessary. Get rid of load_includes() which did the marking
and unload_notloaded_includes() and unload_loaded_includes()
accordingly. There's now one single free_all_includes().
2021-08-18 11:52:53 +02:00
Bram Matthys 796cac7a63 geoip: migrate from simple string to returning a GeoIPResult struct.
(work in progress, 1/2)

This also add supports for callbacks which return pointers (pvoidfunc),
we already had that for efuncs but not in callbacks.
2021-08-17 16:39:39 +02:00
Bram Matthys a43637d55d Add extban->is_banned_events which you need to set to indicate to
which BANCHK_* events you want to listen, eg BANCHK_JOIN, BANCHK_MSG.
You can use BANCHK_ALL to watch on all events.
Only BANCHK_TKL is not included there and needs an explicit
BANCHK_ALL|BANCHK_TKL.

The caller will now take care of BANCHK_* filtering so we won't
waste any CPU on calling an is_banned() function that isn't
interested at all in the event that we have.

Also, no longer require an extban->is_banned function, since some
extbans don't use it. This too saves useless calls.
2021-08-14 18:25:36 +02:00
Bram Matthys ca4f4c2575 Add PROTOCTL NEXTBANS. This indicates support for named extended bans.
If you don't indicate NEXTBANS support then we will send old fashioned
extended bans to you.
Note that eventually we will likely require named extended bans support,
but that will be UnrealIRCd 7 / 8.... ;)
2021-08-14 17:28:15 +02:00
Bram Matthys 445b47391f Do an #undef on LOG_DEBUG, LOG_INFO, etc.. so they cannot be confused
anymore with the ULOG_DEBUG, ULOG_INFO, etc levels.
2021-08-12 15:27:27 +02:00
Bram Matthys 4968bf84fe Newlog: convert those in include/*.h too 2021-08-11 17:59:40 +02:00
Bram Matthys 9308e5b8a0 Change maximum chanmode +l value to 1 million and "coincidentally" also
change the IsInvalidChannelTS() macro to check for this value or lower.
2021-08-11 15:39:15 +02:00
Bram Matthys 9efe590a8e Newlog and fishy timestamp handling:
* New macro IsInvalidChannelTS() which evaluates to ts < 750000
* Check for faulty creation time ("fishy timestamp") at ALL places
  where channel->creationtime is set.
* Also, important, changed behavior:
  if !IsInvalidChannelTS then:
  1) We print our warning
  2) We pretend ts is our channel creationtime (which may be
     TStime() if the channel did not previously exist)
  3) We allow the command through and allow it to merge (in case of SJOIN)

This makes it so we still log the error (noisy) but on the other hand
we won't get "infected" by fishy timestamps since we will never set
them, no matter what happens.
2021-08-11 15:29:45 +02:00
Bram Matthys 3f5fd3d5b8 Newlog: add log_data_channel(). TODO: expand a lot more. 2021-08-11 09:12:57 +02:00
Bram Matthys 798106c805 Avoid logging LINK_DISCONNECTED message twice, and also fix the
IP address in the message. We now use ip:port from the link block
if we failed to connect, and otherwise we use the ip from the
connection if the connection is established (also because it
can be a remote connection, not linked directly to us)
2021-08-10 15:08:07 +02:00
Bram Matthys c5347a554d Remove some old LOG_* loglevels, now that these are using newlog.
Also move SQUIT message to newlog, although this may cause
duplicates, so need to (re-)check later.
2021-08-10 14:54:22 +02:00
Bram Matthys 6e3de0c297 Some reindenting/whitespace in struct.h 2021-08-10 14:48:49 +02:00
Bram Matthys 6e996d7ffb Remove unused structs: ConfigItem_log, ConfigItem_unknown, ConfigItem_unknown_ex 2021-08-10 14:45:20 +02:00
Bram Matthys a4d9ef3947 Get rid of some shorts. Sorry... i hate these :D.
Also get rid of some unused stats struct members.
2021-08-10 14:07:54 +02:00
Bram Matthys cc8b047819 Remove old client->user->flood stuff as it was moved to client->local->flood
a few versions before and is now unused.
2021-08-10 14:00:47 +02:00
Bram Matthys dca7142152 Rename client->user->lastaway to client->user->away_since 2021-08-10 13:57:44 +02:00
Bram Matthys c55e65b47b Remove client->server->timestamp (completely unused) 2021-08-10 13:55:57 +02:00
Bram Matthys 8b19168f1b Get rid of client->server->up, since client->uplink->name provides the
same information.
2021-08-10 13:52:10 +02:00
Bram Matthys 641d514853 Move traffic stats from client->local->sendM/sendK/receiveM/receiveK/sendB/receiveB
into a client->local->traffic struct.
2021-08-10 13:22:59 +02:00
Bram Matthys 420eb2ffb6 Rename client->serv to client->server: this is set if the client is a server,
just like client->user is set if the client is a user.

Rename client->srvptr to client->uplink: this is the uplink that the client
is connected to. If the client is a user then it is set to the server that
the client is connected to, if the client is a server then it is set to the
server that the server is connected to (the.. tadah.. uplink).
For local clients it is always set to &me.
2021-08-10 12:52:46 +02:00
Bram Matthys 0f71381589 typedef aWhowas -> WhoWas 2021-08-10 12:44:54 +02:00
Bram Matthys 90a01ed7f9 Rename client->local->lasttime to client->local->last_msg_received
(Last time any message was received, i.e. the socket was read)
2021-08-10 12:40:07 +02:00
Bram Matthys 73f8976a3a Rename client->local->firsttime to client->local->creationtime
(Time user was created (connected on IRC))
2021-08-10 12:38:07 +02:00
Bram Matthys 43f42edfb7 Rename client->local->nextnick to client->local->next_nick_allowed 2021-08-10 12:36:48 +02:00
Bram Matthys a076e7a93a Remove client->local->lastsq since it is unused (only written, never read) 2021-08-10 12:36:06 +02:00
Bram Matthys 6b36399533 Rename client->local->last to client->local->idle_since
(Last time a RESETIDLE message was received (PRIVMSG))
2021-08-10 12:34:13 +02:00
Bram Matthys 4dbc2ac860 Rename client->local->since to client->local->fake_lag, since it is used
for fake lag calculations only (well, except for 1 corner case).

As said, modules should use the new function:
void add_fake_lag(Client *client, long msec)
2021-08-10 12:26:19 +02:00
Bram Matthys 532a9becda Massive renames of SSL/TLS and SSL to TLS. People should know the term by now :D 2021-08-10 09:07:32 +02:00
Bram Matthys 3832081eed Rename client->user->svid to client->user->account.
Just as a reminder: don't blindly assume that if anything is set here
that the user is logged in, there is IsLoggedIn(client) for that.
Reason: if the account name starts with a digit or is "*" then the
user isn't actually logged in ;)
2021-08-10 08:14:35 +02:00
Bram Matthys b055b862e4 New: NameValue struct and functions nv_find_by_name() / nv_find_by_value().
These were previously used by the config system as config_binary_flags_search()
but can be useful in other areas as well.
2021-08-09 17:43:15 +02:00
Bram Matthys 8187c4049f Renumber PROTO_'s 2021-08-09 09:36:15 +02:00
Bram Matthys 0739af0812 Add initial remote logging support via SLOG (S2S cmd).
Also call the log::destination "remote" instead of "global".
2021-08-07 14:38:06 +02:00
Bram Matthys f4af4acb16 Newlog: fix rehash and memory leak 2021-08-07 14:01:44 +02:00
Bram Matthys e59cd278cd log { } now uses the new log system and is used for logging to disk,
snomasks, opers, global (remote), ..

For disk logs we currently ignore the sources and log everything.

NOTE: REHASH is untested and will memory leak for sure.
2021-08-07 13:04:07 +02:00
Bram Matthys b8837844fb Newlog: new config plan, ditch set::logging and use log blocks soon.
In this commit it is still called logx { }. Will merge them soon
into one log { } block.
2021-08-07 10:39:54 +02:00
Bram Matthys c22207c4ca Drop cf_ prefix from ConfigFile and ce_ prefix from ConfigEntry structs.
Also rename them to describe better what they do.

ConfigFile:
cf_filename -> filename
cf_next -> next
cf_entries -> items

ConfigEntry:
ce_fileptr -> file
ce_varlinenum -> line_number
ce_fileposstart -> file_position_start
ce_fileposend -> file_position_end
ce_sectlinenum -> section_linenumber
ce_varname -> name
ce_vardata -> value
ce_cond -> conditional_config
ce_entries -> items
ce_next -> next
ce_prevlevel -> parent

Also add doxygen docs for both structs.
2021-08-06 17:50:45 +02:00
k4be 50eaee19a7 Merge branch 'unreal60_dev' into unreal60_dev+watch 2021-08-06 15:25:13 +02:00
k4be 55a5574a4b Merge branch 'unreal60_dev' into unreal60_dev+watch 2021-08-06 15:23:37 +02:00
Bram Matthys f34d3bd861 Add set::logging block and the logging to snomask mapping.
Note that without such a block nothing will be sent to ircops at all
(anything that comes from unreal_log anyway).
In a later commit either a snomasks.default.conf will be added and/or
an internal default mapping.

This also moves the recursion trap to earlier in the logging code,
which has the side effect that debug traffic regarding snomasks is
no longer logged.
2021-08-06 15:19:36 +02:00
Bram Matthys 5b44baab1f ULOG_WARN -> ULOG_WARNING. Better be consistent. This was the only
ULOG_* level that used an abbreviated term.
2021-08-06 08:50:45 +02:00