eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit a9c2d71874f2c9b753337c8ea0c4a29ff5a355bd
parent e4222d0ebe911d3c55dc0f27f29ab98aac033724
Author: Marcel Holtmann <marcel@holtmann.org>
Date:   Thu,  1 Nov 2018 21:27:04 +0100

monitor: Use l_get_be16 and l_put_be16 instead of open coding it

Diffstat:
Mmonitor/main.c | 18+++++-------------
Mmonitor/nlmon.c | 11+++--------
2 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/monitor/main.c b/monitor/main.c @@ -459,11 +459,8 @@ static int analyze_pcap(const char *pathname) continue; } - arphrd_type = L_GET_UNALIGNED((const uint16_t *) (buf + 2)); - arphrd_type = L_BE16_TO_CPU(arphrd_type); - - proto_type = L_GET_UNALIGNED((const uint16_t *) (buf + 14)); - proto_type = L_BE16_TO_CPU(proto_type); + arphrd_type = l_get_be16(buf + 2); + proto_type = l_get_be16(buf + 14); switch (arphrd_type) { case ARPHRD_ETHER: @@ -603,14 +600,9 @@ static int process_pcap(struct pcap *pcap, uint16_t id) continue; } - pkt_type = L_GET_UNALIGNED((const uint16_t *) buf); - pkt_type = L_BE16_TO_CPU(pkt_type); - - arphrd_type = L_GET_UNALIGNED((const uint16_t *) (buf + 2)); - arphrd_type = L_BE16_TO_CPU(arphrd_type); - - proto_type = L_GET_UNALIGNED((const uint16_t *) (buf + 14)); - proto_type = L_BE16_TO_CPU(proto_type); + pkt_type = l_get_be16(buf); + arphrd_type = l_get_be16(buf + 2); + proto_type = l_get_be16(buf + 14); switch (arphrd_type) { case ARPHRD_ETHER: diff --git a/monitor/nlmon.c b/monitor/nlmon.c @@ -4049,14 +4049,9 @@ static void store_packet(struct nlmon *nlmon, const struct timeval *tv, memset(sll_hdr, 0, sizeof(sll_hdr)); - pkt_type = L_CPU_TO_BE16(pkt_type); - L_PUT_UNALIGNED(pkt_type, (uint16_t *) buf); - - arphrd_type = L_CPU_TO_BE16(arphrd_type); - L_PUT_UNALIGNED(arphrd_type, (uint16_t *) (buf + 2)); - - proto_type = L_CPU_TO_BE16(proto_type); - L_PUT_UNALIGNED(proto_type, (uint16_t *) (buf + 14)); + l_put_be16(pkt_type, buf); + l_put_be16(arphrd_type, buf + 2); + l_put_be16(proto_type, buf + 14); pcap_write(nlmon->pcap, tv, &sll_hdr, sizeof(sll_hdr), data, size); }