Lines Matching refs:neg

275 	negp			neg;		/* used when negotiating */  member
380 KASSERT(sp->neg != NULL, ("%s: no neg", __func__)); in init_tags()
381 sp->neg->numtags = 0; in init_tags()
387 negp neg = sp->neg; in insert_tag() local
390 KASSERT(neg != NULL, ("%s: no neg", __func__)); in insert_tag()
391 if ((i = neg->numtags++) < NUMTAGS) { in insert_tag()
392 neg->tags[i] = tp; in insert_tag()
396 neg->numtags--; in insert_tag()
410 struct pppoe_full_hdr *wh = &sp->neg->pkt->pkt_header; in make_packet()
417 KASSERT((sp->neg != NULL) && (sp->neg->m != NULL), in make_packet()
422 for (count = 0, tag = sp->neg->tags; in make_packet()
423 ((count < sp->neg->numtags) && (count < NUMTAGS)); in make_packet()
428 sp->neg->numtags = count; in make_packet()
436 sp->neg->m->m_len = length + sizeof(*wh); in make_packet()
437 sp->neg->m->m_pkthdr.len = length + sizeof(*wh); in make_packet()
460 negp neg = sp->neg; in pppoe_match_svc() local
463 if (neg->service_len == 0) in pppoe_match_svc()
467 if (neg->service_len == 1 && neg->service.data[0] == '*') in pppoe_match_svc()
471 if (neg->service_len != ntohs(tag->tag_len)) in pppoe_match_svc()
474 if (strncmp((const char *)(tag + 1), neg->service.data, in pppoe_match_svc()
521 negp neg = sp->neg; in pppoe_find_svc() local
523 if (neg->service_len == svc_len && in pppoe_find_svc()
524 strncmp(svc_name, neg->service.data, svc_len) == 0) in pppoe_find_svc()
630 if (sp->neg == NULL) in pppoe_finduniq()
632 if (sp->neg->host_uniq_len == ntohs(tag->tag_len) && in pppoe_finduniq()
633 bcmp(sp->neg->host_uniq.data, (const char *)(tag + 1), in pppoe_finduniq()
634 sp->neg->host_uniq_len) == 0) in pppoe_finduniq()
786 negp neg = NULL; in ng_pppoe_rcvmsg() local
887 neg = malloc(sizeof(*neg), M_NETGRAPH_PPPOE, in ng_pppoe_rcvmsg()
890 if (neg == NULL) in ng_pppoe_rcvmsg()
893 neg->m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); in ng_pppoe_rcvmsg()
894 if (neg->m == NULL) { in ng_pppoe_rcvmsg()
895 free(neg, M_NETGRAPH_PPPOE); in ng_pppoe_rcvmsg()
898 neg->m->m_pkthdr.rcvif = NULL; in ng_pppoe_rcvmsg()
899 sp->neg = neg; in ng_pppoe_rcvmsg()
900 ng_callout_init(&neg->handle); in ng_pppoe_rcvmsg()
901 neg->m->m_len = sizeof(struct pppoe_full_hdr); in ng_pppoe_rcvmsg()
902 neg->pkt = mtod(neg->m, union packet*); in ng_pppoe_rcvmsg()
903 memcpy((void *)&neg->pkt->pkt_header.eh, in ng_pppoe_rcvmsg()
905 neg->pkt->pkt_header.ph.ver = 0x1; in ng_pppoe_rcvmsg()
906 neg->pkt->pkt_header.ph.type = 0x1; in ng_pppoe_rcvmsg()
907 neg->pkt->pkt_header.ph.sid = 0x0000; in ng_pppoe_rcvmsg()
908 neg->timeout = 0; in ng_pppoe_rcvmsg()
959 bcopy(ourmsg->data + acnpos, neg->ac_name.data, acnlen); in ng_pppoe_rcvmsg()
960 neg->ac_name_len = acnlen; in ng_pppoe_rcvmsg()
962 neg->host_uniq.hdr.tag_type = PTT_HOST_UNIQ; in ng_pppoe_rcvmsg()
965 neg->host_uniq.hdr.tag_len = htons(sizeof(sp)); in ng_pppoe_rcvmsg()
966 bcopy(&sp, neg->host_uniq.data, sizeof(sp)); in ng_pppoe_rcvmsg()
967 neg->host_uniq_len = sizeof(sp); in ng_pppoe_rcvmsg()
974 neg->host_uniq.hdr.tag_len = htons((uint16_t)(hulen / 2 - 1)); in ng_pppoe_rcvmsg()
983 neg->host_uniq.data[i / 2] = j << 4; in ng_pppoe_rcvmsg()
985 neg->host_uniq.data[i / 2] |= j; in ng_pppoe_rcvmsg()
987 neg->host_uniq_len = hulen / 2 - 1; in ng_pppoe_rcvmsg()
990 neg->host_uniq.hdr.tag_len = htons((uint16_t)hulen); in ng_pppoe_rcvmsg()
991 bcopy(ourmsg->data + hupos, neg->host_uniq.data, hulen); in ng_pppoe_rcvmsg()
992 neg->host_uniq_len = hulen; in ng_pppoe_rcvmsg()
995 neg->service.hdr.tag_type = PTT_SRV_NAME; in ng_pppoe_rcvmsg()
996 neg->service.hdr.tag_len = htons((uint16_t)srvlen); in ng_pppoe_rcvmsg()
997 bcopy(ourmsg->data + srvpos, neg->service.data, srvlen); in ng_pppoe_rcvmsg()
998 neg->service_len = srvlen; in ng_pppoe_rcvmsg()
1012 neg->service.hdr.tag_type = PTT_SRV_NAME; in ng_pppoe_rcvmsg()
1013 neg->service.hdr.tag_len = in ng_pppoe_rcvmsg()
1017 bcopy(ourmsg->data, neg->service.data, in ng_pppoe_rcvmsg()
1019 neg->service_len = ourmsg->data_len; in ng_pppoe_rcvmsg()
1020 neg->pkt->pkt_header.ph.code = PADT_CODE; in ng_pppoe_rcvmsg()
1034 neg->ac_name.hdr.tag_type = PTT_AC_NAME; in ng_pppoe_rcvmsg()
1035 neg->ac_name.hdr.tag_len = in ng_pppoe_rcvmsg()
1038 bcopy(ourmsg->data, neg->ac_name.data, in ng_pppoe_rcvmsg()
1040 neg->ac_name_len = ourmsg->data_len; in ng_pppoe_rcvmsg()
1041 neg->pkt->pkt_header.ph.code = PADO_CODE; in ng_pppoe_rcvmsg()
1058 neg = sp->neg; in ng_pppoe_rcvmsg()
1059 neg->service.hdr.tag_type = PTT_SRV_NAME; in ng_pppoe_rcvmsg()
1060 neg->service.hdr.tag_len = in ng_pppoe_rcvmsg()
1064 bcopy(ourmsg->data, neg->service.data, in ng_pppoe_rcvmsg()
1066 neg->service_len = ourmsg->data_len; in ng_pppoe_rcvmsg()
1280 negp neg = sp->neg; in pppoe_start() local
1293 memcpy((void *)&neg->pkt->pkt_header.eh, &privp->eh, in pppoe_start()
1295 neg->pkt->pkt_header.ph.code = PADI_CODE; in pppoe_start()
1297 insert_tag(sp, &neg->host_uniq.hdr); in pppoe_start()
1298 insert_tag(sp, &neg->service.hdr); in pppoe_start()
1305 ng_callout(&neg->handle, node, hook, PPPOE_INITIAL_TIMEOUT * hz, in pppoe_start()
1307 neg->timeout = PPPOE_INITIAL_TIMEOUT * 2; in pppoe_start()
1308 m0 = m_copypacket(neg->m, M_NOWAIT); in pppoe_start()
1484 negp neg = sp->neg; in ng_pppoe_rcvdata() local
1501 neg->pkt->pkt_header.eh.ether_type = wh->eh.ether_type; in ng_pppoe_rcvdata()
1504 ng_uncallout(&neg->handle, node); in ng_pppoe_rcvdata()
1513 neg->pkt->pkt_header.eh.ether_dhost, in ng_pppoe_rcvdata()
1516 neg->timeout = 0; in ng_pppoe_rcvdata()
1517 neg->pkt->pkt_header.ph.code = PADO_CODE; in ng_pppoe_rcvdata()
1526 insert_tag(sp, &neg->ac_name.hdr); /* AC_NAME */ in ng_pppoe_rcvdata()
1537 (neg->service.hdr.tag_len != 0)) { in ng_pppoe_rcvdata()
1538 insert_tag(sp, &neg->service.hdr); /* SERVICE */ in ng_pppoe_rcvdata()
1549 ng_callout(&neg->handle, node, hook, PPPOE_OFFER_TIMEOUT * hz, in ng_pppoe_rcvdata()
1551 m0 = m_copypacket(sp->neg->m, M_NOWAIT); in ng_pppoe_rcvdata()
1584 negp neg = NULL; in ng_pppoe_rcvdata_ether() local
1722 neg = sp->neg; in ng_pppoe_rcvdata_ether()
1724 if (neg->ac_name_len) { in ng_pppoe_rcvdata_ether()
1730 if (neg->ac_name_len != htons(tag->tag_len) || in ng_pppoe_rcvdata_ether()
1731 strncmp(neg->ac_name.data, in ng_pppoe_rcvdata_ether()
1733 neg->ac_name_len) != 0) { in ng_pppoe_rcvdata_ether()
1738 ng_uncallout(&neg->handle, node); in ng_pppoe_rcvdata_ether()
1747 neg->pkt->pkt_header.eh.ether_dhost, in ng_pppoe_rcvdata_ether()
1749 neg->timeout = 0; in ng_pppoe_rcvdata_ether()
1750 neg->pkt->pkt_header.ph.code = PADR_CODE; in ng_pppoe_rcvdata_ether()
1762 insert_tag(sp, &neg->service.hdr); /* Service */ in ng_pppoe_rcvdata_ether()
1766 ng_callout(&neg->handle, node, sp->hook, in ng_pppoe_rcvdata_ether()
1769 neg->timeout = PPPOE_INITIAL_TIMEOUT * 2; in ng_pppoe_rcvdata_ether()
1770 m0 = m_copypacket(neg->m, M_NOWAIT); in ng_pppoe_rcvdata_ether()
1804 neg = sp->neg; in ng_pppoe_rcvdata_ether()
1805 ng_uncallout(&neg->handle, node); in ng_pppoe_rcvdata_ether()
1806 neg->pkt->pkt_header.ph.code = PADS_CODE; in ng_pppoe_rcvdata_ether()
1808 neg->pkt->pkt_header.ph.sid = in ng_pppoe_rcvdata_ether()
1812 neg->timeout = 0; in ng_pppoe_rcvdata_ether()
1817 insert_tag(sp, &neg->ac_name.hdr); /* AC_NAME */ in ng_pppoe_rcvdata_ether()
1828 m0 = m_copypacket(sp->neg->m, M_NOWAIT); in ng_pppoe_rcvdata_ether()
1839 sp->pkt_hdr = neg->pkt->pkt_header; in ng_pppoe_rcvdata_ether()
1875 neg = sp->neg; in ng_pppoe_rcvdata_ether()
1876 ng_uncallout(&neg->handle, node); in ng_pppoe_rcvdata_ether()
1877 neg->pkt->pkt_header.ph.sid = wh->ph.sid; in ng_pppoe_rcvdata_ether()
1881 neg->timeout = 0; in ng_pppoe_rcvdata_ether()
1888 sp->pkt_hdr = neg->pkt->pkt_header; in ng_pppoe_rcvdata_ether()
1896 m_freem(neg->m); in ng_pppoe_rcvdata_ether()
1897 free(sp->neg, M_NETGRAPH_PPPOE); in ng_pppoe_rcvdata_ether()
1898 sp->neg = NULL; in ng_pppoe_rcvdata_ether()
1957 m_freem(sp->neg->m); in ng_pppoe_rcvdata_ether()
1958 ng_uncallout(&sp->neg->handle, node); in ng_pppoe_rcvdata_ether()
1959 free(sp->neg, M_NETGRAPH_PPPOE); in ng_pppoe_rcvdata_ether()
1960 sp->neg = NULL; in ng_pppoe_rcvdata_ether()
2100 if (sp->neg) { in ng_pppoe_disconnect()
2101 ng_uncallout(&sp->neg->handle, node); in ng_pppoe_disconnect()
2102 if (sp->neg->m) in ng_pppoe_disconnect()
2103 m_freem(sp->neg->m); in ng_pppoe_disconnect()
2104 free(sp->neg, M_NETGRAPH_PPPOE); in ng_pppoe_disconnect()
2123 negp neg = sp->neg; in pppoe_ticker() local
2138 m0 = m_copypacket(sp->neg->m, M_NOWAIT); in pppoe_ticker()
2140 ng_callout(&neg->handle, node, hook, neg->timeout * hz, in pppoe_ticker()
2142 if ((neg->timeout <<= 1) > PPPOE_TIMEOUT_LIMIT) { in pppoe_ticker()
2147 neg->timeout = PPPOE_TIMEOUT_LIMIT; in pppoe_ticker()