Commit 340992dd authored by ke hu's avatar ke hu Committed by Reidar Cederqvist

mcast-pa : replace list to safe list

parent e764ee6d
......@@ -702,6 +702,11 @@ static int is_zero_mac(uint8_t *mac)
int
mcg_br_entry_equal(struct br_mdb_entry *ex, struct br_mdb_entry *ey)
{
if(ex == NULL || ey == NULL)
{
syslog(LOG_NOTICE,"mcast-pa: equal is empty");
return 0;
}
if (ex->ifindex == ey->ifindex) {
if (ex->addr.u.ip4 == ey->addr.u.ip4) {
if (memcmp(&ex->src_addr.eth_addr, &ey->src_addr.eth_addr, ETH_ALEN) == 0) {
......@@ -1035,6 +1040,7 @@ mcg_br_entry_leave(struct mcg_br_mdb_entry_t *head, struct br_mdb_entry *e)
{
SPRINT_BUF(group);
struct list_head *pos;
struct list_head *tmp;
struct mcg_br_mdb_entry_t *mcge;
int len = 0;
char src[INET_ADDR_SIZE]; /**< ip address of video source - head use only */
......@@ -1044,6 +1050,7 @@ mcg_br_entry_leave(struct mcg_br_mdb_entry_t *head, struct br_mdb_entry *e)
if (!mcastpa.params.bridged) {
if (mcastpa.params.use_src == 0) {
if (head->src[0] == 0) {
syslog(LOG_NOTICE,"mcast-pa:leave no video src");
return (-ENOENT); /* not ready to join - no video src */
}
strcpy(src, head->src);
......@@ -1061,14 +1068,14 @@ mcg_br_entry_leave(struct mcg_br_mdb_entry_t *head, struct br_mdb_entry *e)
mjl.flags |= MJL_FLAG_SRCIP;
sprintf((char *) &mjl.srcip, "%s", src);
sprintf((char *) &mjl.wan, "%s", mcast_wan_entry_default());
list_for_each(pos, &head->mcg_entry) {
list_for_each_safe(pos,tmp, &head->mcg_entry) {
mjl.flags |= MJL_FLAG_LAN;
mcge = (struct mcg_br_mdb_entry_t *) list_entry(pos, struct mcg_br_mdb_entry_t, mcg_entry);
if (!mcg_br_entry_equal(e, &mcge->e)) {
len += sprintf((char *) (mjl.lan + len), " %s ", (char *) ll_index_to_name(mcge->e.ifindex));
}
}
list_for_each(pos, &head->mcg_entry) {
list_for_each_safe(pos,tmp, &head->mcg_entry) {
mcge = (struct mcg_br_mdb_entry_t *) list_entry(pos, struct mcg_br_mdb_entry_t, mcg_entry);
mcg_br_entry_srcmac_set(mcge, &mjl);
if (e != NULL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment