MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sctp_mark_ifa_addr_down

Function sctp_mark_ifa_addr_down

freebsd/netinet/sctp_pcb.c:306–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

304}
305
306void
307sctp_mark_ifa_addr_down(uint32_t vrf_id, struct sockaddr *addr,
308 const char *if_name, uint32_t ifn_index)
309{
310 struct sctp_vrf *vrf;
311 struct sctp_ifa *sctp_ifap;
312
313 SCTP_IPI_ADDR_RLOCK();
314 vrf = sctp_find_vrf(vrf_id);
315 if (vrf == NULL) {
316 SCTPDBG(SCTP_DEBUG_PCB4, "Can't find vrf_id 0x%x\n", vrf_id);
317 goto out;
318 }
319 sctp_ifap = sctp_find_ifa_by_addr(addr, vrf->vrf_id, SCTP_ADDR_LOCKED);
320 if (sctp_ifap == NULL) {
321 SCTPDBG(SCTP_DEBUG_PCB4, "Can't find sctp_ifap for address\n");
322 goto out;
323 }
324 if (sctp_ifap->ifn_p == NULL) {
325 SCTPDBG(SCTP_DEBUG_PCB4, "IFA has no IFN - can't mark unusable\n");
326 goto out;
327 }
328 if (if_name) {
329 if (strncmp(if_name, sctp_ifap->ifn_p->ifn_name, SCTP_IFNAMSIZ) != 0) {
330 SCTPDBG(SCTP_DEBUG_PCB4, "IFN %s of IFA not the same as %s\n",
331 sctp_ifap->ifn_p->ifn_name, if_name);
332 goto out;
333 }
334 } else {
335 if (sctp_ifap->ifn_p->ifn_index != ifn_index) {
336 SCTPDBG(SCTP_DEBUG_PCB4, "IFA owned by ifn_index:%d down command for ifn_index:%d - ignored\n",
337 sctp_ifap->ifn_p->ifn_index, ifn_index);
338 goto out;
339 }
340 }
341
342 sctp_ifap->localifa_flags &= (~SCTP_ADDR_VALID);
343 sctp_ifap->localifa_flags |= SCTP_ADDR_IFA_UNUSEABLE;
344out:
345 SCTP_IPI_ADDR_RUNLOCK();
346}
347
348void
349sctp_mark_ifa_addr_up(uint32_t vrf_id, struct sockaddr *addr,

Callers

nothing calls this directly

Calls 3

sctp_find_vrfFunction · 0.85
sctp_find_ifa_by_addrFunction · 0.85
strncmpFunction · 0.85

Tested by

no test coverage detected