From 714ec5f541629d2647cfb34e6bdda1a7b46b7866 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Mon, 18 Mar 2024 06:12:00 +0100 Subject: [PATCH] Rename struct member ifi_ifindex -> ifi_index Signed-off-by: Joachim Wiberg --- src/config.c | 4 ++-- src/iface.c | 22 +++++++++++----------- src/iface.h | 2 +- src/igmp.c | 6 +++--- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/config.c b/src/config.c index 2666051..d808ec6 100644 --- a/src/config.c +++ b/src/config.c @@ -68,7 +68,7 @@ struct ifi *config_find_iface(int ifindex) struct ifi *ifi; TAILQ_FOREACH(ifi, &ifaces, ifi_link) { - if (ifindex == ifi->ifi_ifindex) + if (ifindex == ifi->ifi_index) return ifi; } @@ -126,7 +126,7 @@ struct ifi *config_iface_add(char *ifname) */ ifindex = if_nametoindex(ifname); if (ifindex) - ifi->ifi_ifindex = ifindex; + ifi->ifi_index = ifindex; else ifi->ifi_flags |= IFIF_DOWN; diff --git a/src/iface.c b/src/iface.c index e11650b..051abe0 100644 --- a/src/iface.c +++ b/src/iface.c @@ -61,7 +61,7 @@ void iface_exit(void) /* Deletes the entire list and all sub-lists. */ TAILQ_FOREACH_SAFE(ifi, &ifaces, ifi_link, ifi_tmp) { - iface_del(ifi->ifi_ifindex, 0); + iface_del(ifi->ifi_index, 0); TAILQ_FOREACH_SAFE(a, &ifi->ifi_static, al_link, tmp) { TAILQ_REMOVE(&ifi->ifi_static, a, al_link); @@ -192,7 +192,7 @@ void iface_add(int ifindex, int flags) return; logit(LOG_DEBUG, 0, "Marking %s as now available in system", ifi->ifi_name); - ifi->ifi_ifindex = ifindex; + ifi->ifi_index = ifindex; iface_check(ifindex, flags); } @@ -230,7 +230,7 @@ void iface_del(int ifindex, int flags) ifi->ifi_prev_addr = 0; ifi->ifi_curr_addr = 0; - ifi->ifi_ifindex = 0; + ifi->ifi_index = 0; ifi->ifi_flags |= IFIF_DOWN; } @@ -293,7 +293,7 @@ void iface_check_state(void) logit(LOG_WARNING, errno, "Failed ioctl SIOCGIFFLAGS for %s", ifr.ifr_name); } - iface_check(ifi->ifi_ifindex, ifr.ifr_flags); + iface_check(ifi->ifi_index, ifr.ifr_flags); } checking_iface = 0; @@ -519,7 +519,7 @@ void accept_membership_query(int ifindex, uint32_t src, uint32_t dst, uint32_t g g->al_query = pev_timer_del(g->al_query); /* setup a timeout to remove the group membership */ - g->al_timerid = delete_group_timer(ifi->ifi_ifindex, g, IGMP_LAST_MEMBER_QUERY_COUNT + g->al_timerid = delete_group_timer(ifi->ifi_index, g, IGMP_LAST_MEMBER_QUERY_COUNT * tmo / IGMP_TIMER_SCALE); logit(LOG_DEBUG, 0, "Timer for grp %s on %s set to %d", @@ -602,7 +602,7 @@ void accept_group_report(int ifindex, uint32_t src, uint32_t dst, uint32_t group if (g->al_timerid > 0) g->al_timerid = pev_timer_del(g->al_timerid); - g->al_timerid = delete_group_timer(ifi->ifi_ifindex, g, IGMP_GROUP_MEMBERSHIP_INTERVAL); + g->al_timerid = delete_group_timer(ifi->ifi_index, g, IGMP_GROUP_MEMBERSHIP_INTERVAL); /* * Reset timer for switching version back every time an older @@ -612,7 +612,7 @@ void accept_group_report(int ifindex, uint32_t src, uint32_t dst, uint32_t group if (g->al_pv_timerid) g->al_pv_timerid = pev_timer_del(g->al_pv_timerid); - g->al_pv_timerid = group_version_timer(ifi->ifi_ifindex, g); + g->al_pv_timerid = group_version_timer(ifi->ifi_index, g); } break; } @@ -649,14 +649,14 @@ void accept_group_report(int ifindex, uint32_t src, uint32_t dst, uint32_t group /** set a timer for expiration **/ g->al_query = 0; g->al_reporter = src; - g->al_timerid = delete_group_timer(ifi->ifi_ifindex, g, IGMP_GROUP_MEMBERSHIP_INTERVAL); + g->al_timerid = delete_group_timer(ifi->ifi_index, g, IGMP_GROUP_MEMBERSHIP_INTERVAL); /* * Set timer for swithing version back if an older version * report is received */ if (g->al_pv < 3) - g->al_pv_timerid = group_version_timer(ifi->ifi_ifindex, g); + g->al_pv_timerid = group_version_timer(ifi->ifi_index, g); TAILQ_INSERT_TAIL(&ifi->ifi_groups, g, al_link); time(&g->al_ctime); @@ -722,9 +722,9 @@ void accept_leave_message(int ifindex, uint32_t src, uint32_t dst, uint32_t grou g->al_timerid = pev_timer_del(g->al_timerid); /** send a group specific query **/ - g->al_query = send_query_timer(ifi->ifi_ifindex, g, igmp_last_member_interval, + g->al_query = send_query_timer(ifi->ifi_index, g, igmp_last_member_interval, IGMP_LAST_MEMBER_QUERY_COUNT); - g->al_timerid = delete_group_timer(ifi->ifi_ifindex, g, igmp_last_member_interval + g->al_timerid = delete_group_timer(ifi->ifi_index, g, igmp_last_member_interval * (IGMP_LAST_MEMBER_QUERY_COUNT + 1)); logit(LOG_DEBUG, 0, "Accepted group leave for %s on %s", s3, s1); diff --git a/src/iface.h b/src/iface.h index d3551b9..e7f7993 100644 --- a/src/iface.h +++ b/src/iface.h @@ -17,7 +17,7 @@ struct ifi { uint32_t ifi_flags; /* IFIF_ flags defined below */ uint32_t ifi_vlan; /* Raw VLAN ID for send and accept */ char ifi_name[IFNAMSIZ]; /* interface name */ - int ifi_ifindex; /* Primarily for Linux systems */ + int ifi_index; /* Primarily for Linux systems */ uint32_t ifi_curr_addr; /* Current address of this interface */ uint32_t ifi_prev_addr; /* Previous address of this interace */ uint32_t ifi_query_interval; /* IGMP query interval */ diff --git a/src/igmp.c b/src/igmp.c index 1de42c0..f7d0f50 100644 --- a/src/igmp.c +++ b/src/igmp.c @@ -113,7 +113,7 @@ void igmp_iface_init(struct ifi *ifi) struct sockaddr_ll sll = { .sll_family = AF_PACKET, .sll_protocol = htons(ETH_P_ALL), - .sll_ifindex = ifi->ifi_ifindex, + .sll_ifindex = ifi->ifi_index, }; int ena = 1; @@ -200,7 +200,7 @@ static void igmp_read(int sd, void *arg) /* The sll.sll_ifindex holds the sender's ifindex */ eth_len = sizeof(struct ether_header); - accept_igmp(ifi->ifi_ifindex, recv_buf + eth_len, len - eth_len); + accept_igmp(ifi->ifi_index, recv_buf + eth_len, len - eth_len); } /* @@ -520,7 +520,7 @@ void send_igmp(const struct ifi *ifi, uint32_t dst, int type, int code, uint32_t /* Make sure to send in same interface we're receiving */ sll.sll_family = AF_PACKET; sll.sll_protocol = htons(ETH_P_ALL); - sll.sll_ifindex = ifi->ifi_ifindex; + sll.sll_ifindex = ifi->ifi_index; rc = sendto(ifi->ifi_sock, send_buf, len, 0, (struct sockaddr *)&sll, sizeof(sll)); if (rc < 0) {