summaryrefslogtreecommitdiff
path: root/src/ipcpd/eth/eth.c
diff options
context:
space:
mode:
authorDimitri Staessens <[email protected]>2022-03-26 09:39:49 +0100
committerSander Vrijders <[email protected]>2022-03-30 15:05:05 +0200
commit63dde087796bfcd730508b069ebae7c79b7cebe8 (patch)
treee5e338b9583d023c5895ed0d3a20b679fae76ddf /src/ipcpd/eth/eth.c
parent0b45e1e5363f61febc7033f1b9bda14689c88644 (diff)
downloadouroboros-63dde087796bfcd730508b069ebae7c79b7cebe8.tar.gz
ouroboros-63dde087796bfcd730508b069ebae7c79b7cebe8.zip
lib: Refactor reading packet from rbuff
Reading packets from the rbuff and checking their validity (non-zero size, pass crc check, pass decryption) is now extracted into a function. Also adds a function to get the length of an sdu_du_buff instead of subtracting the tail and head pointers. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/ipcpd/eth/eth.c')
-rw-r--r--src/ipcpd/eth/eth.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ipcpd/eth/eth.c b/src/ipcpd/eth/eth.c
index 25f42fc8..53dc3b69 100644
--- a/src/ipcpd/eth/eth.c
+++ b/src/ipcpd/eth/eth.c
@@ -950,7 +950,7 @@ static void * eth_ipcp_packet_reader(void * o)
deid = ntohs(e_frame->eid);
if (deid == MGMT_EID) {
#elif defined (BUILD_ETH_LLC)
- if (length > 0x05FF) {/* DIX */
+ if (length > 0x05FF) { /* DIX */
#ifndef HAVE_NETMAP
ipcp_sdb_release(sdb);
#endif
@@ -1067,7 +1067,7 @@ static void * eth_ipcp_packet_writer(void * o)
continue;
}
- len = shm_du_buff_tail(sdb) - shm_du_buff_head(sdb);
+ len = shm_du_buff_len(sdb);
if (shm_du_buff_head_alloc(sdb, ETH_HEADER_TOT_SIZE)
== NULL) {