Skip to content

Commit

Permalink
Rename struct member ifi_ifindex -> ifi_index
Browse files Browse the repository at this point in the history
Signed-off-by: Joachim Wiberg <[email protected]>
  • Loading branch information
troglobit committed Mar 18, 2024
1 parent 34c8f79 commit 714ec5f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;

Expand Down
22 changes: 11 additions & 11 deletions src/iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand All @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/iface.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
6 changes: 3 additions & 3 deletions src/igmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}

/*
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 714ec5f

Please sign in to comment.