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

Function sctp_mark_ifa_addr_up

freebsd/netinet/sctp_pcb.c:348–388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

346}
347
348void
349sctp_mark_ifa_addr_up(uint32_t vrf_id, struct sockaddr *addr,
350 const char *if_name, uint32_t ifn_index)
351{
352 struct sctp_vrf *vrf;
353 struct sctp_ifa *sctp_ifap;
354
355 SCTP_IPI_ADDR_RLOCK();
356 vrf = sctp_find_vrf(vrf_id);
357 if (vrf == NULL) {
358 SCTPDBG(SCTP_DEBUG_PCB4, "Can't find vrf_id 0x%x\n", vrf_id);
359 goto out;
360 }
361 sctp_ifap = sctp_find_ifa_by_addr(addr, vrf->vrf_id, SCTP_ADDR_LOCKED);
362 if (sctp_ifap == NULL) {
363 SCTPDBG(SCTP_DEBUG_PCB4, "Can't find sctp_ifap for address\n");
364 goto out;
365 }
366 if (sctp_ifap->ifn_p == NULL) {
367 SCTPDBG(SCTP_DEBUG_PCB4, "IFA has no IFN - can't mark unusable\n");
368 goto out;
369 }
370 if (if_name) {
371 if (strncmp(if_name, sctp_ifap->ifn_p->ifn_name, SCTP_IFNAMSIZ) != 0) {
372 SCTPDBG(SCTP_DEBUG_PCB4, "IFN %s of IFA not the same as %s\n",
373 sctp_ifap->ifn_p->ifn_name, if_name);
374 goto out;
375 }
376 } else {
377 if (sctp_ifap->ifn_p->ifn_index != ifn_index) {
378 SCTPDBG(SCTP_DEBUG_PCB4, "IFA owned by ifn_index:%d down command for ifn_index:%d - ignored\n",
379 sctp_ifap->ifn_p->ifn_index, ifn_index);
380 goto out;
381 }
382 }
383
384 sctp_ifap->localifa_flags &= (~SCTP_ADDR_IFA_UNUSEABLE);
385 sctp_ifap->localifa_flags |= SCTP_ADDR_VALID;
386out:
387 SCTP_IPI_ADDR_RUNLOCK();
388}
389
390/*-
391 * Add an ifa to an ifn.

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