1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-27 11:46:40 +02:00
Commit Graph

2322 Commits

Author SHA1 Message Date
Bram Matthys 4e5dd044f5 Require module header with version "unrealircd-6" now 2021-08-10 14:37:10 +02:00
Bram Matthys 2c011202a4 Integrate iConf.network in iConf itself as the distinction between
these "network settings" and other settings has been lost in time.

Rename some of these variables and macro's.
ircnetwork -> NETWORK_NAME
ircnet005 -> NETWORK_NAME_005
defserv ->? DEFAULT_SERVER
hidden_host -> CLOAK_PREFIX
helpchan -> HELP_CHANNEL

Also one config change (visible to admins):
set::hiddenhost-prefix is now set::cloak-prefix
We still accept the old name, though.
The example conf has been updated as well, but not the wiki yet.
2021-08-10 14:22:42 +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 dca7142152 Rename client->user->lastaway to client->user->away_since 2021-08-10 13:57:44 +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 cc1e361ba9 More simplifications / code cleanups in stats.c 2021-08-10 13:32:36 +02:00
Bram Matthys fa263570a4 Get rid of some debug stuff in stats which i never look at anyway 2021-08-10 13:26:44 +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 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 4d947c3e51 Convert fake lag changes to use void add_fake_lag(Client *client, long msec) 2021-08-10 12:24:16 +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 3a9975713a Move connect_server() from src/socket.c to src/modules/server.c (efunc) 2021-08-09 12:10:24 +02:00
Bram Matthys 88e9b51354 Newlog: now really finish server.c conversion. Yeah, there were more... 2021-08-09 11:59:39 +02:00
Bram Matthys d795bd7d39 Newlog: finish server.c conversion... and enjoy the new multiline logging :D 2021-08-09 10:18:25 +02:00
Bram Matthys 4ad7d02ffa Changes to unrl_utf8_make_valid():
1) No longer impose a static maximum length
2) Caller must provide a work buffer and maximum length
3) Add a strict length check option
2021-08-09 08:49:01 +02:00
Bram Matthys 91a3c71d60 We now (try to) kill the "old" server when a server links in with the same
name, handy when the old server is a zombie waiting for ping timeout.

NOTE: atm this only works if someone links directly to us and there is
an existing server local or remote.
There is no code yet for a remote & remote scenario, which requires (or
at least prefers) having a creationtime for server connects, requiring
a SID command change.
2021-08-08 20:15:22 +02:00
Bram Matthys 2c8ef11004 Newlog: finished server.c conversion, yay. 2021-08-08 19:34:46 +02:00
Bram Matthys 65e97e4140 Fix crash in set::server-linking::autoconnect-strategy sequential-fallback
when a remote server links to another server.
2021-08-08 15:57:33 +02:00
Bram Matthys a198d99850 Newlog: SLOG: actually use the JSON "msg" instead of parv[4]
And document SLOG command.
2021-08-08 15:27:04 +02:00
Bram Matthys f501772cbe Whoops... remove multi-line logging test code :D 2021-08-08 15:11:34 +02:00
Bram Matthys 53e283082f For IRCOps with unrealircd.org/json-log: in case of a multi-line message
we will now only send the JSON in the first message.

Also fix log file timestamp missing with multiline.

And rename do_unreal_log_ircops() to do_unreal_log_opers()

Add safe_free_message_tags()
2021-08-08 15:10:04 +02:00
Bram Matthys bc9e17aeb0 Add multiline support to unreal_log()
Any \n's will be expanded to multiple lines.
* For JSON disk logging there is no change.
* For text disk logging it will show as:
  [time] facility subsys.CODE+
  [time] facility subsys.CODE+
  [time] facility subsys.CODE
  So a plus sign is added if another message is to follow.
* For notices to opers/snomasks exactly the same (plus sign if needed).

Untested. More changes to follow eg to notice dropping the json
in the followup msgs.

This also changes the logging format for text disk to match
the output on server notices, we no longer log as:
[TS] facility subsystem event_code: msg....
But as:
[TS] facility subsystem.event_code: msg....
2021-08-08 12:04:41 +02:00
Bram Matthys 2eb1f97d25 Newlog: server.c: Use SERVER_LINKED_REMOTE for remote links as
they use a slightly different format and you may want to exclude
these from certain logging. Also mention the correct uplink there.
2021-08-08 11:18:51 +02:00
Bram Matthys bac8b297c7 Newlog: more server.c conversions (all local server connect rejects done) 2021-08-08 11:02:44 +02:00
Bram Matthys 12adca5817 Set client->name early to provided servername and drop the servername
argument from verify_link() since now you can just use client->name.

Also more newlog for server.c (more to follow)
2021-08-08 10:15:59 +02:00
Bram Matthys f843fc6d23 Serialize json with JSON_COMPACT.
Saves a bit of room, especially when the JSON travels over network this
maybe save some "crucial" bytes (and in that case it looks better too,
since the \s's in message tags only make it less readable).
2021-08-07 18:14:38 +02:00
Bram Matthys fbe3d6124b Add unrealircd.org/json-log CAP, which sends JSON logs to IRCOps.
This basically enhances the regular snomask/ircop notices with
JSON logs, the same logs that are logged to disk (with type 'json').
This allows bots/machines to much more easily parse server notices
such as connect notices or.. anything.

Note that JSON logs are quite large, so make sure the ircop has
a BIG class::sendq!

Also, everyone can set the cap but it is only effective for IRCOps.
2021-08-07 17:32:54 +02:00
Bram Matthys ab180b086c Rename recently added mtag: s2s/json -> unrealircd.org/json-log 2021-08-07 17:17:37 +02:00
Bram Matthys 9885af1486 Validate and rewrite remotely received JSON via SLOG cmd.
This makes it use OUR timestamp, so timestamps in logs are properly
sequential. The originial timestamp is saved in "original_timestamp".
Finally, we (over)write "log_source" with the remote server name.
2021-08-07 15:49:29 +02:00
Bram Matthys 64180d8a2c Send and receive json as well in SLOG server to server message.
TODO: validate JSON
2021-08-07 15:22:06 +02:00
Bram Matthys 654a88a53a Easy message tags sending restrictions to permit full 4094 bytes.
Needed for next commits.
2021-08-07 15:20:53 +02:00
Bram Matthys 659b553351 Add slog.c, initial version of S2S logging. 2021-08-07 14:40:08 +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 839367272a Rename $client.nuh to $client.details as it is generic detailed
client information and not necessarily nick!user@host in all cases.
2021-08-06 20:59:54 +02:00
Bram Matthys f38a43434e Newlog: expand client.server more, and also move some stuff to client.user
This means we now have $client.user.username but the expansion system
does not allow items more than 2 deep atm (only $client.something
but not $client.something.other). Will fix later. (TODO)
In the meantime the connection notice will look weird :D
2021-08-06 20:32:35 +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 55a5574a4b Merge branch 'unreal60_dev' into unreal60_dev+watch 2021-08-06 15:23:37 +02:00
Bram Matthys 065d24e248 In register_user() use client->user->XXX instead of user->XXX.
Has always been annoying me.. :D
2021-08-06 11:11:09 +02:00
Bram Matthys 92757f6d9f Newlog: convert local client connects and disconnects.
Also makes the connect message and the standard log message consistent.
2021-08-06 11:05:59 +02:00
Bram Matthys 4a72b8f519 Remove unnecessary debugging/benchmark info from eos, channeldb, reputation, tkldb 2021-08-06 10:32:42 +02:00
Bram Matthys 088996b16e Make ulining an UnrealIRCd server a fatal link error instead of a warning.
https://www.unrealircd.org/docs/FAQ#bad-ulines
2021-08-06 09:39:09 +02:00
Bram Matthys ddf639836b Cleanup server.c: make server_sync() function only do the syncing and
move the parts that deal with adding lists, tagging as uline etc back
to the caller, that is.. cmd_server().
2021-08-06 09:36:38 +02:00
Bram Matthys 4de2fa648f Some more server_sync cleanups 2021-08-06 09:32:59 +02:00
Bram Matthys 64f62adb1b Code cleanup in server_sync(): cptr -> client 2021-08-06 09:29:29 +02:00