diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2025-08-17 12:09:12 +0200 |
---|---|---|
committer | Sander Vrijders <sander@ouroboros.rocks> | 2025-09-10 08:19:52 +0200 |
commit | 5274cb3ce09c40cccd29ec771ad49a2069aa37c4 (patch) | |
tree | 634d94ede018b6c108a85e30e5f29f1725bf6100 /src/ipcpd/eth/eth.c | |
parent | f2a6a1c302a5e962c61857ed4a2f03bd5991b41c (diff) | |
download | ouroboros-5274cb3ce09c40cccd29ec771ad49a2069aa37c4.tar.gz ouroboros-5274cb3ce09c40cccd29ec771ad49a2069aa37c4.zip |
ipcpd: Add ipcpd over UDP/IPv6
This adds an IPCP that runs over UDP/IPv6. It's structured like the
eth-dix and eth-llc in that it builds two separate binaries:
ipcpd-udp4 and ipcpd-udp6. The IRM CLI is backwards compatible in that
type 'udp' will resolve to type 'udp4'.
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/ipcpd/eth/eth.c')
-rw-r--r-- | src/ipcpd/eth/eth.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/ipcpd/eth/eth.c b/src/ipcpd/eth/eth.c index 1028ee03..d39b478c 100644 --- a/src/ipcpd/eth/eth.c +++ b/src/ipcpd/eth/eth.c @@ -113,7 +113,6 @@ #define ETH_MTU_MAX 1500 #endif /* BUILD_ETH_DIX */ -#define MAC_SIZE 6 #define ETH_TYPE_LENGTH_SIZE sizeof(uint16_t) #define ETH_HEADER_SIZE (2 * MAC_SIZE + ETH_TYPE_LENGTH_SIZE) @@ -694,11 +693,11 @@ static int eth_ipcp_name_query_req(const uint8_t * hash, static int eth_ipcp_name_query_reply(const uint8_t * hash, uint8_t * r_addr) { - uint64_t address = 0; + struct addr addr; - memcpy(&address, r_addr, MAC_SIZE); + memcpy(&addr.mac, r_addr, MAC_SIZE); - shim_data_dir_add_entry(eth_data.shim_data, hash, address); + shim_data_dir_add_entry(eth_data.shim_data, hash, addr); shim_data_dir_query_respond(eth_data.shim_data, hash); @@ -1699,7 +1698,7 @@ static int eth_ipcp_flow_alloc(int fd, uint8_t ssap = 0; #endif uint8_t r_addr[MAC_SIZE]; - uint64_t addr = 0; + struct addr addr; assert(hash); @@ -1708,10 +1707,12 @@ static int eth_ipcp_flow_alloc(int fd, HASH_VAL32(hash)); return -1; } + addr = shim_data_dir_get_addr(eth_data.shim_data, hash); + memcpy(r_addr, &addr.mac, MAC_SIZE); - pthread_rwlock_wrlock(ð_data.flows_lock); #ifdef BUILD_ETH_LLC + pthread_rwlock_wrlock(ð_data.flows_lock); ssap = bmp_allocate(eth_data.saps); if (!bmp_is_id_valid(eth_data.saps, ssap)) { pthread_rwlock_unlock(ð_data.flows_lock); @@ -1721,10 +1722,8 @@ static int eth_ipcp_flow_alloc(int fd, eth_data.fd_to_ef[fd].sap = ssap; eth_data.ef_to_fd[ssap] = fd; -#endif pthread_rwlock_unlock(ð_data.flows_lock); - - memcpy(r_addr, &addr, MAC_SIZE); +#endif if (eth_ipcp_alloc(r_addr, #if defined(BUILD_ETH_DIX) |