From: Ondrej Zajicek (work) Date: Sun, 11 Mar 2018 23:25:25 +0000 (+0100) Subject: Minor fixme - MIFs X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33d7612d23fe17a9c689ecf0c0062408161f477c;p=thirdparty%2Fbird.git Minor fixme - MIFs --- diff --git a/nest/iface.c b/nest/iface.c index 16b06c7c2..ea02ea66e 100644 --- a/nest/iface.c +++ b/nest/iface.c @@ -765,6 +765,26 @@ mif_get(struct mif_group *grp, struct iface *iface) return mif; } +struct mif * +mif_find(struct mif_group *grp, struct iface *iface) +{ + WALK_ARRAY(grp->mifs, MIFS_MAX, mif) + if (mif && (mif->iface == iface)) + return mif; + + return NULL; +} + +struct mif * +mif_find_by_index(struct mif_group *grp, uint index) +{ + WALK_ARRAY(grp->mifs, MIFS_MAX, mif) + if (mif && (mif->iface->index == index)) + return mif; + + return NULL; +} + void mif_free(struct mif_group *grp, struct mif *mif) { @@ -801,7 +821,7 @@ mif_listen_igmp(struct mif_group *grp, struct mif *mif, sock *s) * modify it to preserve it for others. */ static void -mif_do_forward(sock *src, sock *dst, int len) +mif_do_forward(sock *src, sock *dst, uint len) { if (!dst->rx_hook) return; diff --git a/nest/iface.h b/nest/iface.h index 3bd8d0318..48db2e41c 100644 --- a/nest/iface.h +++ b/nest/iface.h @@ -132,6 +132,8 @@ struct iface *if_get_by_name(char *); void if_recalc_all_preferred_addresses(void); struct mif *mif_get(struct mif_group *grp, struct iface *iface); +struct mif *mif_find(struct mif_group *grp, struct iface *iface); +struct mif *mif_find_by_index(struct mif_group *grp, uint index); void mif_free(struct mif_group *grp, struct mif *mif); #define MIFS_SET(mif,m) ((m) |= (1 << (mif)->index))