diff options
author | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-05-31 12:08:57 +0200 |
---|---|---|
committer | Jose M. Guisado <jguisado@soleta.eu> | 2022-06-01 08:51:19 +0200 |
commit | a0a3470682852d5f72967553d5debe41e86eca78 (patch) | |
tree | 7b3155246a1c5ffee6ed4f5dd442cc6196a4a260 /src/utils.c | |
parent | c0573b9ef05bc1c22a6b5b71c2f73ba18a8696f1 (diff) |
#1074 rest: set_mode: add support for different ogserver addresses
Add foreign key "identornos" from table "entornos" to table
"ordenadores".
A row in table "entornos" represent a valid ogServer address.
Multiple ogServer valid addresses can exist when running several
instances or a single ogServer instance is exposed to different networks.
Can't delete rows in "entornos" table nor update their id (primary
key) if the row has any associated clients ({ON UPDATE/ON DELETE} RESTRICT).
Allows assigning different but valid ogServer IPs to clients.
Enabling support for multiple instances of ogServer (e.g: load balancing) or
exposing a single ogServer instance to different networks (e.g: VLAN).
Look up for the valid ogServer IP of a given client when changing a
client's mode (og_set_client_mode).
Determines valid ogServer IP using a JOIN statement.
JOIN entornos USING(identorno)
Reuses the fetched ip using a statement variable.
@serverip:=entornos.ipserveradm
For example, for a two VLAN setup:
vlan1 ogserver: 192.168.56.10
vlan2 ogserver: 192.168.57.10
The "entornos" table should look like:
identorno ipserveradm ...
--------- ----------- ...
1 192.168.56.10 ...
2 192.168.57.10 ...
And computers in the "ordenadores" table might look like:
idordenador identorno ...
---------- --------- ...
1 1 ...
2 1 ...
3 2 ...
4 2 ...
... ... ...
Additionally, splits the SQL query for better readability.
Co-authored-by: Jose Guisado <jguisado@soleta.eu>
Diffstat (limited to 'src/utils.c')
0 files changed, 0 insertions, 0 deletions