diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2025-07-17 21:32:12 +0200 |
---|---|---|
committer | Sander Vrijders <sander@ouroboros.rocks> | 2025-07-23 15:07:59 +0200 |
commit | 1856a585ae4290e666314ee7907dc8cbbb08fe2d (patch) | |
tree | b3062938a8b18ffd9eded99074de62b14e57b2f6 /src/ipcpd/unicast/addr-auth | |
parent | 4ed5f4527ba034b399386beea2949bccf69ce65a (diff) | |
download | ouroboros-1856a585ae4290e666314ee7907dc8cbbb08fe2d.tar.gz ouroboros-1856a585ae4290e666314ee7907dc8cbbb08fe2d.zip |
ipcpd: Refactor ipcp main struct
The ipcpi (IPCP instance) is now cleanly tucked away within its source
file instead of exposed all over the place.
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/ipcpd/unicast/addr-auth')
-rw-r--r-- | src/ipcpd/unicast/addr-auth/flat.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/ipcpd/unicast/addr-auth/flat.c b/src/ipcpd/unicast/addr-auth/flat.c index c4562935..dfdeccd6 100644 --- a/src/ipcpd/unicast/addr-auth/flat.c +++ b/src/ipcpd/unicast/addr-auth/flat.c @@ -35,13 +35,13 @@ #include "flat.h" #define NAME_LEN 8 +#define INVALID_ADDRESS 0 struct { - uint8_t addr_size; + uint8_t addr_size; + uint32_t addr; } flat; -#define INVALID_ADDRESS 0 - struct addr_auth_ops flat_ops = { .init = flat_init, .fini = flat_fini, @@ -57,6 +57,12 @@ int flat_init(const void * info) return -1; } +#if defined (CONFIG_OUROBOROS_DEBUG) && defined (IPCP_DEBUG_LOCAL) + flat.addr = getpid(); +#else + while (flat.addr == INVALID_ADDRESS) + random_buffer(&flat.addr,sizeof(flat.addr)); +#endif return 0; } @@ -67,13 +73,5 @@ int flat_fini(void) uint64_t flat_address(void) { - uint32_t addr = INVALID_ADDRESS; - -#if defined (CONFIG_OUROBOROS_DEBUG) && defined (IPCP_DEBUG_LOCAL) - addr = getpid(); -#else - while (addr == INVALID_ADDRESS) - random_buffer(&addr,sizeof(addr)); -#endif - return addr; + return (uint64_t) flat.addr; } |