pmlag

Poor man's link aggregation
git clone git://git.finwo.net/app/pmlag
Log | Files | Refs | README | LICENSE

commit b243d57af614d76e6895a929fc511c7eaab18dad
parent edc9bcd0c79006e05a1aca0fbfb43d36fc8c6a19
Author: Yersa Nordman <yersa@finwo.nl>
Date:   Fri, 13 Oct 2023 22:53:00 +0200

Removed saddr_ll from sendto during broadcast

Diffstat:
Msrc/main.c | 5+----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/main.c b/src/main.c @@ -218,7 +218,6 @@ int main(int argc, const char **argv) { // Prepare announce buffer uint16_t ethtype = htons(0x0666); - struct sockaddr_ll saddr_ll; size_t anc_buflen = (ETH_ALEN*2) + sizeof(ethtype) + sizeof(uint16_t) + sizeof(uint16_t); // mac + ethertype + command + broadcast-index char *anc_buffer = malloc(anc_buflen); @@ -325,7 +324,6 @@ int main(int argc, const char **argv) { bond->bc_id = htons(bond->bc_id); // Prepare packet - memcpy(saddr_ll.sll_addr , bond->hwaddr , ETH_ALEN); memset(anc_buffer , 0xFF , ETH_ALEN); // Send to broadcast memcpy(anc_buffer + (1*ETH_ALEN) , bond->hwaddr , ETH_ALEN); // From bond memcpy(anc_buffer + (2*ETH_ALEN) , &ethtype , sizeof(ethtype)); // ethtype 0x0666 @@ -338,8 +336,7 @@ int main(int argc, const char **argv) { // Send packet on all interfaces for( i=0; i < bond->iface_count ; i++ ) { iface = bond->iface[i]; - saddr_ll.sll_ifindex = iface->ifidx; - if (sendto(iface->sockfd, anc_buffer, anc_buflen, 0, (const struct sockaddr*)&saddr_ll, sizeof(struct sockaddr_ll)) != anc_buflen) { + if (sendto(iface->sockfd, anc_buffer, anc_buflen, 0, NULL, 0) != anc_buflen) { perror("sendto"); printf("Error during sendto on %d\n", __LINE__); }