Lines Matching defs:neg

260 	negp			neg;		/* used when negotiating */
367 KASSERT(sp->neg != NULL, ("%s: no neg", __func__));
368 sp->neg->numtags = 0;
374 negp neg = sp->neg;
377 KASSERT(neg != NULL, ("%s: no neg", __func__));
378 if ((i = neg->numtags++) < NUMTAGS) {
379 neg->tags[i] = tp;
383 neg->numtags--;
392 * Also assume that neg->wh points to the correct
397 struct pppoe_full_hdr *wh = &sp->neg->pkt->pkt_header;
404 KASSERT((sp->neg != NULL) && (sp->neg->m != NULL),
409 for (count = 0, tag = sp->neg->tags;
410 ((count < sp->neg->numtags) && (count < NUMTAGS));
415 sp->neg->numtags = count;
423 sp->neg->m->m_len = length + sizeof(*wh);
424 sp->neg->m->m_pkthdr.len = length + sizeof(*wh);
447 negp neg = sp->neg;
450 if (neg->service_len == 0)
454 if (neg->service_len == 1 && neg->service.data[0] == '*')
458 if (neg->service_len != ntohs(tag->tag_len))
461 if (strncmp((const char *)(tag + 1), neg->service.data,
508 negp neg = sp->neg;
510 if (neg->service_len == svc_len &&
511 strncmp(svc_name, neg->service.data, svc_len) == 0)
617 if (sp->neg == NULL)
619 if (sp->neg->host_uniq_len == ntohs(tag->tag_len) &&
620 bcmp(sp->neg->host_uniq.data, (const char *)(tag + 1),
621 sp->neg->host_uniq_len) == 0)
772 negp neg = NULL;
873 neg = malloc(sizeof(*neg), M_NETGRAPH_PPPOE,
876 if (neg == NULL)
879 neg->m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
880 if (neg->m == NULL) {
881 free(neg, M_NETGRAPH_PPPOE);
884 neg->m->m_pkthdr.rcvif = NULL;
885 sp->neg = neg;
886 ng_callout_init(&neg->handle);
887 neg->m->m_len = sizeof(struct pppoe_full_hdr);
888 neg->pkt = mtod(neg->m, union packet*);
889 memcpy((void *)&neg->pkt->pkt_header.eh,
891 neg->pkt->pkt_header.ph.ver = 0x1;
892 neg->pkt->pkt_header.ph.type = 0x1;
893 neg->pkt->pkt_header.ph.sid = 0x0000;
894 neg->timeout = 0;
945 bcopy(ourmsg->data + acnpos, neg->ac_name.data, acnlen);
946 neg->ac_name_len = acnlen;
948 neg->host_uniq.hdr.tag_type = PTT_HOST_UNIQ;
951 neg->host_uniq.hdr.tag_len = htons(sizeof(sp));
952 bcopy(&sp, neg->host_uniq.data, sizeof(sp));
953 neg->host_uniq_len = sizeof(sp);
960 neg->host_uniq.hdr.tag_len = htons((uint16_t)(hulen / 2 - 1));
969 neg->host_uniq.data[i / 2] = j << 4;
971 neg->host_uniq.data[i / 2] |= j;
973 neg->host_uniq_len = hulen / 2 - 1;
976 neg->host_uniq.hdr.tag_len = htons((uint16_t)hulen);
977 bcopy(ourmsg->data + hupos, neg->host_uniq.data, hulen);
978 neg->host_uniq_len = hulen;
981 neg->service.hdr.tag_type = PTT_SRV_NAME;
982 neg->service.hdr.tag_len = htons((uint16_t)srvlen);
983 bcopy(ourmsg->data + srvpos, neg->service.data, srvlen);
984 neg->service_len = srvlen;
996 neg->service.hdr.tag_type = PTT_SRV_NAME;
997 neg->service.hdr.tag_len =
1001 bcopy(ourmsg->data, neg->service.data,
1003 neg->service_len = ourmsg->data_len;
1004 neg->pkt->pkt_header.ph.code = PADT_CODE;
1018 neg->ac_name.hdr.tag_type = PTT_AC_NAME;
1019 neg->ac_name.hdr.tag_len =
1022 bcopy(ourmsg->data, neg->ac_name.data,
1024 neg->ac_name_len = ourmsg->data_len;
1025 neg->pkt->pkt_header.ph.code = PADO_CODE;
1042 neg = sp->neg;
1043 neg->service.hdr.tag_type = PTT_SRV_NAME;
1044 neg->service.hdr.tag_len =
1048 bcopy(ourmsg->data, neg->service.data,
1050 neg->service_len = ourmsg->data_len;
1260 negp neg = sp->neg;
1273 memcpy((void *)&neg->pkt->pkt_header.eh, &privp->eh,
1275 neg->pkt->pkt_header.ph.code = PADI_CODE;
1277 insert_tag(sp, &neg->host_uniq.hdr);
1278 insert_tag(sp, &neg->service.hdr);
1285 ng_callout(&neg->handle, node, hook, PPPOE_INITIAL_TIMEOUT * hz,
1287 neg->timeout = PPPOE_INITIAL_TIMEOUT * 2;
1288 m0 = m_copypacket(neg->m, M_NOWAIT);
1458 negp neg = sp->neg;
1479 neg->pkt->pkt_header.eh.ether_type = wh->eh.ether_type;
1482 ng_uncallout(&neg->handle, node);
1491 neg->pkt->pkt_header.eh.ether_dhost,
1494 neg->timeout = 0;
1495 neg->pkt->pkt_header.ph.code = PADO_CODE;
1504 insert_tag(sp, &neg->ac_name.hdr); /* AC_NAME */
1515 (neg->service.hdr.tag_len != 0)) {
1516 insert_tag(sp, &neg->service.hdr); /* SERVICE */
1527 ng_callout(&neg->handle, node, hook, PPPOE_OFFER_TIMEOUT * hz,
1529 m0 = m_copypacket(sp->neg->m, M_NOWAIT);
1562 negp neg = NULL;
1702 neg = sp->neg;
1704 if (neg->ac_name_len) {
1710 if (neg->ac_name_len != htons(tag->tag_len) ||
1711 strncmp(neg->ac_name.data,
1713 neg->ac_name_len) != 0) {
1718 ng_uncallout(&neg->handle, node);
1727 neg->pkt->pkt_header.eh.ether_dhost,
1729 neg->timeout = 0;
1730 neg->pkt->pkt_header.ph.code = PADR_CODE;
1742 insert_tag(sp, &neg->service.hdr); /* Service */
1746 ng_callout(&neg->handle, node, sp->hook,
1749 neg->timeout = PPPOE_INITIAL_TIMEOUT * 2;
1750 m0 = m_copypacket(neg->m, M_NOWAIT);
1784 neg = sp->neg;
1785 ng_uncallout(&neg->handle, node);
1786 neg->pkt->pkt_header.ph.code = PADS_CODE;
1788 neg->pkt->pkt_header.ph.sid =
1792 neg->timeout = 0;
1797 insert_tag(sp, &neg->ac_name.hdr); /* AC_NAME */
1808 m0 = m_copypacket(sp->neg->m, M_NOWAIT);
1819 sp->pkt_hdr = neg->pkt->pkt_header;
1855 neg = sp->neg;
1856 ng_uncallout(&neg->handle, node);
1857 neg->pkt->pkt_header.ph.sid = wh->ph.sid;
1861 neg->timeout = 0;
1868 sp->pkt_hdr = neg->pkt->pkt_header;
1876 m_freem(neg->m);
1877 free(sp->neg, M_NETGRAPH_PPPOE);
1878 sp->neg = NULL;
1937 m_freem(sp->neg->m);
1938 ng_uncallout(&sp->neg->handle, node);
1939 free(sp->neg, M_NETGRAPH_PPPOE);
1940 sp->neg = NULL;
2076 if (sp->neg) {
2077 ng_uncallout(&sp->neg->handle, node);
2078 if (sp->neg->m)
2079 m_freem(sp->neg->m);
2080 free(sp->neg, M_NETGRAPH_PPPOE);
2099 negp neg = sp->neg;
2114 m0 = m_copypacket(sp->neg->m, M_NOWAIT);
2116 ng_callout(&neg->handle, node, hook, neg->timeout * hz,
2118 if ((neg->timeout <<= 1) > PPPOE_TIMEOUT_LIMIT) {
2123 neg->timeout = PPPOE_TIMEOUT_LIMIT;