Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent overfilling of routing table #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions usr.sbin/mcast-proxy/mrt.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,9 @@ RB_HEAD(mrtree, multicast_route) mrtree = RB_INITIALIZER(&mrtree);

struct multicast_origin *mo_lookup(struct molist *, struct intf_data *,
union uaddr *);
struct multicast_origin *mrt_addorigin(struct multicast_route *,
struct intf_data *,union uaddr *);
void mrt_addorigin(struct multicast_route *, struct intf_data *, union uaddr *);
void _mrt_delorigin(struct multicast_route *, struct multicast_origin *);
void mrt_delorigin(struct multicast_route *, struct intf_data *,
union uaddr *);
void mrt_delorigin(struct multicast_route *, struct intf_data *, union uaddr *);

void mrt_timeradd(struct event *);
void mrt_timer(int, short, void *);
Expand Down Expand Up @@ -87,7 +85,7 @@ mo_lookup(struct molist *molist, struct intf_data *id, union uaddr *addr)
return NULL;
}

struct multicast_origin *
void
mrt_addorigin(struct multicast_route *mr, struct intf_data *id,
union uaddr *addr)
{
Expand All @@ -105,13 +103,13 @@ mrt_addorigin(struct multicast_route *mr, struct intf_data *id,
addr, &mr->mr_group, &mr->mr_molist);
}
mo->mo_alive = 1;
return mo;
return;
}

mo = calloc(1, sizeof(*mo));
if (mo == NULL) {
log_warn("%s: calloc", __func__);
return NULL;
return;
}

LIST_INSERT_HEAD(&mr->mr_molist, mo, mo_entry);
Expand All @@ -132,7 +130,11 @@ mrt_addorigin(struct multicast_route *mr, struct intf_data *id,
&mr->mr_group, &mr->mr_molist);
}

return mo;
/* Do not keep upstream as item on the group list. */
if (id == upstreamif) {
LIST_REMOVE(mo, mo_entry);
free(mo);
}
}

void
Expand Down