bool pim_groupconf_node::set_property(const char *key, const char *value) { if (!strcmp(key, "rp")) { if (!strcmp(value, "none")) return set_property_inst("rp", property_def::VAL_ADDRESS, "::/128"); else return set_property_inst("rp", property_def::VAL_ADDRESS, value); } else if (!strcmp(key, "accept_rp")) { if (!strcmp(value, "none")) { return set_property_inst("rp", property_def::VAL_ADDRESS, "::/128"); } else if (strcmp(value, "embedded") == 0) { inet6_addr tmp; if (!pim_group_node::calculate_embedded_rp_addr(((groupconf *)parent())->id(), tmp)) { if (pim->should_log(WARNING)) { pim->log().writeline("Group doesn't follow Embedded-RP specification, " "changing accept_rp to any."); } return false; } /* sigh */ return set_property_inst("accept_rp", property_def::VAL_ADDRESS, tmp.as_string().c_str()); } } else if (!strcmp(key, "rp_adv")) { #ifndef PIM_NO_BSR bool prev = get_property_bool("rp_adv"); if (!set_property_inst("rp_adv", property_def::VAL_BOOL, value)) return false; if (prev != get_property_bool("rp_adv")) pim->bsr().enable_rp_adv(((groupconf *)parent())->id(), !prev); return true; #else return false; #endif } else if (!strcmp(key, "rp-rejected-source-policy")) { if (!has_property("rp-rejected-source-policy")) { if (!instantiate_property("rp-rejected-source-policy", new propval_enum(rp_rej_entries))) return false; } } else if (!strcmp(key, "rp-embedded-auto-source-acl")) { return set_property_inst("rp-embedded-auto-source-acl", property_def::VAL_BOOL, value); } return groupconf_node::set_property(key, value); }
bool pim_groupconf_node::rp_source_acl_accepts(const pim_group_node *gn, const in6_addr &src) const { if (gn->is_embedded()) { if (get_property_bool("rp-embedded-auto-source-acl")) { return gn->embedded_rp_addr().matches(src); } } return rp_source_acl.accepts(src); }
bool pim_intfconf_node::support_old_cisco_addrlist() const { return get_property_bool("cisco-old-addrlist"); }
static void rebuildSelector(struct htmlTag *sel, jsobjtype oa, int len2) { int i1, i2, len1; bool check2; char *s; const char *selname; bool changed = false; struct htmlTag *t; jsobjtype oo; /* option object */ len1 = cw->numTags; i1 = i2 = 0; selname = sel->name; if (!selname) selname = "?"; debugPrint(4, "testing selector %s %d %d", selname, len1, len2); sel->lic = (sel->multiple ? 0 : -1); while (i1 < len1 && i2 < len2) { /* there is more to both lists */ t = tagList[i1++]; if (t->action != TAGACT_OPTION) continue; if (t->controller != sel) continue; /* find the corresponding option object */ if ((oo = get_array_element_object(oa, i2)) == NULL) { /* Wow this shouldn't happen. */ /* Guess I'll just pretend the array stops here. */ len2 = i2; --i1; break; } t->jv = oo; /* should already equal oo */ t->rchecked = get_property_bool(oo, "defaultSelected"); check2 = get_property_bool(oo, "selected"); if (check2) { if (sel->multiple) ++sel->lic; else sel->lic = i2; } ++i2; if (t->checked != check2) changed = true; t->checked = check2; s = get_property_string(oo, "text"); if (s && !t->textval || !stringEqual(t->textval, s)) { nzFree(t->textval); t->textval = s; changed = true; } else nzFree(s); s = get_property_string(oo, "value"); if (s && !t->value || !stringEqual(t->value, s)) { nzFree(t->value); t->value = s; } else nzFree(s); } /* one list or the other or both has run to the end */ if (i2 == len2) { for (; i1 < len1; ++i1) { t = tagList[i1]; if (t->action != TAGACT_OPTION) continue; if (t->controller != sel) continue; /* option is gone in js, disconnect this option tag from its select */ t->jv = 0; t->controller = 0; t->action = TAGACT_NOP; changed = true; } } else if (i1 == len1) { for (; i2 < len2; ++i2) { if ((oo = get_array_element_object(oa, i2)) == NULL) break; t = newTag("option"); t->lic = i2; t->controller = sel; t->jv = oo; t->step = 2; // already decorated t->textval = get_property_string(oo, "text"); t->value = get_property_string(oo, "value"); t->checked = get_property_bool(oo, "selected"); if (t->checked) { if (sel->multiple) ++sel->lic; else sel->lic = i2; } t->rchecked = get_property_bool(oo, "defaultSelected"); changed = true; } } if (!changed) return; debugPrint(4, "selector %s has changed", selname); /* If js change the menu, it should have also changed select.value * according to the checked options, but did it? * Don't know, so I'm going to do it here. */ s = displayOptions(sel); if (!s) s = emptyString; set_property_string(sel->jv, "value", s); javaSetsTagVar(sel->jv, s); nzFree(s); if (!sel->multiple) set_property_number(sel->jv, "selectedIndex", sel->lic); } /* rebuildSelector */