* Graft a source entry into an existing socket-layer filter set, * maintaining any required invariants and checking allocations. * * The source is marked as being in the new filter mode at t1. * * Return the pointer to the new node, otherwise return NULL. */
| 789 | * Return the pointer to the new node, otherwise return NULL. |
| 790 | */ |
| 791 | static struct in_msource * |
| 792 | imf_graft(struct in_mfilter *imf, const uint8_t st1, |
| 793 | const struct sockaddr_in *psin) |
| 794 | { |
| 795 | struct ip_msource *nims; |
| 796 | struct in_msource *lims; |
| 797 | |
| 798 | #ifdef FSTACK |
| 799 | nims = malloc(sizeof(struct ip_msource), M_INMFILTER, |
| 800 | #else |
| 801 | nims = malloc(sizeof(struct in_msource), M_INMFILTER, |
| 802 | #endif |
| 803 | M_NOWAIT | M_ZERO); |
| 804 | if (nims == NULL) |
| 805 | return (NULL); |
| 806 | lims = (struct in_msource *)nims; |
| 807 | lims->ims_haddr = ntohl(psin->sin_addr.s_addr); |
| 808 | lims->imsl_st[0] = MCAST_UNDEFINED; |
| 809 | lims->imsl_st[1] = st1; |
| 810 | RB_INSERT(ip_msource_tree, &imf->imf_sources, nims); |
| 811 | ++imf->imf_nsrc; |
| 812 | |
| 813 | return (lims); |
| 814 | } |
| 815 | |
| 816 | /* |
| 817 | * Prune a source entry from an existing socket-layer filter set, |
no test coverage detected