Lines Matching refs:pif

76 	dhcp_pif_t *pif;
82 if ((pif = calloc(1, sizeof (*pif))) == NULL) {
83 dhcpmsg(MSG_ERR, "insert_pif: cannot allocate pif entry for "
89 pif->pif_isv6 = isv6;
90 pif->pif_hold_count = 1;
91 pif->pif_running = B_TRUE;
93 if (strlcpy(pif->pif_name, pname, LIFNAMSIZ) >= LIFNAMSIZ) {
112 pif->pif_index = lifr.lifr_index;
136 pif->pif_max = lifr.lifr_mtu;
138 if (pif->pif_max < DHCP_DEF_MAX_SIZE) {
140 "support DHCP (%u < %u)", pname, pif->pif_max,
147 * Check if the pif is in an IPMP group. Interfaces using IPMP don't
167 pif->pif_hwtype = dlpi_arptype(lifgr.gi_mactype);
168 pif->pif_under_ipmp = (strcmp(pname, lifgr.gi_grifname) != 0);
169 (void) strlcpy(pif->pif_grifname, lifgr.gi_grifname, LIFNAMSIZ);
180 if (pif->pif_under_ipmp) {
181 (void) strlcpy(lifr.lifr_name, pif->pif_grifname,
190 pif->pif_grindex = lifr.lifr_index;
198 if (!isv6 && pif->pif_hwtype == 0) {
223 pif->pif_hwtype = dlpi_arptype(dlinfo.di_mactype);
224 pif->pif_hwlen = dlinfo.di_physaddrlen;
227 pname, pif->pif_hwtype, pif->pif_hwlen);
229 if (pif->pif_hwlen > 0) {
230 pif->pif_hwaddr = malloc(pif->pif_hwlen);
231 if (pif->pif_hwaddr == NULL) {
237 (void) memcpy(pif->pif_hwaddr, dlinfo.di_physaddr,
238 pif->pif_hwlen);
245 insque(pif, isv6 ? &v6root : &v4root);
247 return (pif);
251 release_pif(pif);
263 hold_pif(dhcp_pif_t *pif)
265 pif->pif_hold_count++;
266 dhcpmsg(MSG_DEBUG2, "hold_pif: hold count on %s: %u", pif->pif_name,
267 pif->pif_hold_count);
279 release_pif(dhcp_pif_t *pif)
281 if (pif->pif_hold_count == 0) {
286 if (--pif->pif_hold_count == 0) {
288 pif->pif_name);
290 remque(pif);
291 free(pif->pif_hwaddr);
292 free(pif);
295 pif->pif_name, pif->pif_hold_count);
315 lookup_pif_by_uindex(uint16_t ifindex, dhcp_pif_t *pif, boolean_t isv6)
317 if (pif == NULL)
318 pif = isv6 ? v6root : v4root;
320 pif = pif->pif_next;
322 for (; pif != NULL; pif = pif->pif_next) {
323 if ((pif->pif_index & 0xffff) == ifindex)
327 return (pif);
341 dhcp_pif_t *pif;
343 pif = isv6 ? v6root : v4root;
345 for (; pif != NULL; pif = pif->pif_next) {
346 if (strcmp(pif->pif_name, pname) == 0)
350 return (pif);
362 pif_status(dhcp_pif_t *pif, boolean_t isup)
367 pif->pif_running = isup;
368 dhcpmsg(MSG_DEBUG, "interface %s has %s", pif->pif_name,
370 for (lif = pif->pif_lifs; lif != NULL; lif = lif->lif_next) {
383 if (pif->pif_isv6) { \
404 insert_lif(dhcp_pif_t *pif, const char *lname, int *error)
421 lif->lif_pif = pif;
435 fd = pif->pif_isv6 ? v6_sock_fd : v4_sock_fd;
473 if ((lifr.lifr_flags & IFF_RUNNING) && !pif->pif_running) {
474 pif_status(pif, B_TRUE);
475 } else if (!(lifr.lifr_flags & IFF_RUNNING) && pif->pif_running) {
476 pif_status(pif, B_FALSE);
487 } else if (!pif->pif_isv6 && (lifr.lifr_flags & IFF_BROADCAST)) {
499 if (pif->pif_isv6)
505 insque(lif, &pif->pif_lifs);
552 dhcp_pif_t *pif;
561 pif = lif->lif_pif;
562 if (pif->pif_isv6)
566 release_pif(pif);
642 lookup_lif_by_name(const char *lname, const dhcp_pif_t *pif)
646 for (lif = pif->pif_lifs; lif != NULL; lif = lif->lif_next) {
733 dhcp_pif_t *pif = lif->lif_pif;
738 isv6 = pif->pif_isv6;
771 if (lifr.lifr_index != pif->pif_index) {
774 lif->lif_name, pif->pif_index, lifr.lifr_index);
778 if (pif->pif_under_ipmp) {
779 (void) strlcpy(lifr.lifr_name, pif->pif_grifname, LIFNAMSIZ);
789 if (lifr.lifr_index != pif->pif_grindex) {
792 pif->pif_grindex, lifr.lifr_index);
962 plumb_lif(dhcp_pif_t *pif, const in6_addr_t *addr)
972 for (lif = pif->pif_lifs; lif != NULL; lif = lif->lif_next) {
982 (void) strlcpy(lifr.lifr_name, pif->pif_name, sizeof (lifr.lifr_name));
984 dhcpmsg(MSG_ERR, "plumb_lif: SIOCLIFADDIF %s", pif->pif_name);
1016 if (pif->pif_under_ipmp && !(lifr.lifr_flags & IFF_NOFAILOVER))
1027 hold_pif(pif);
1028 if ((lif = insert_lif(pif, lifr.lifr_name, &error)) == NULL)
1107 dhcp_pif_t *pif;
1114 if ((pif = lookup_pif_by_name(pname, isv6)) != NULL)
1115 hold_pif(pif);
1116 else if ((pif = insert_pif(pname, isv6, error)) == NULL)
1119 if (lookup_lif_by_name(lname, pif) != NULL) {
1122 release_pif(pif);
1128 return (insert_lif(pif, lname, error));
1145 dhcp_pif_t *pif = lif->lif_pif;
1147 fd = pif->pif_isv6 ? v6_sock_fd : v4_sock_fd;
1188 if (pif->pif_under_ipmp && !(lifr.lifr_flags & IFF_NOFAILOVER))
1338 dhcp_pif_t *pif = lif->lif_pif;
1373 &pif->pif_index, sizeof (int)) == -1) {
1391 ifindex = pif->pif_under_ipmp ? pif->pif_grindex : pif->pif_index;
1411 if (pif->pif_under_ipmp && !(lifr.lifr_flags & IFF_NOFAILOVER)) {
1458 if (bringup && pif->pif_under_ipmp) {
1459 (void) strlcpy(lifr.lifr_name, pif->pif_grifname, LIFNAMSIZ);
1615 dhcp_pif_t *pif;
1621 pif = isv6 ? v6root : v4root;
1622 for (; pif != NULL; pif = pif->pif_next) {
1623 for (lif = pif->pif_lifs; lif != NULL;