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

Function pppoe_start

freebsd/netgraph/ng_pppoe.c:1260–1296  ·  view source on GitHub ↗

* Start a client into the first state. A separate function because * it can be needed if the negotiation times out. */

Source from the content-addressed store, hash-verified

1258 * it can be needed if the negotiation times out.
1259 */
1260static void
1261pppoe_start(sessp sp)
1262{
1263 hook_p hook = sp->hook;
1264 node_p node = NG_HOOK_NODE(hook);
1265 priv_p privp = NG_NODE_PRIVATE(node);
1266 negp neg = sp->neg;
1267 struct mbuf *m0;
1268 int error;
1269
1270 /*
1271 * Kick the state machine into starting up.
1272 */
1273 CTR2(KTR_NET, "%20s: called %d", __func__, sp->Session_ID);
1274 sp->state = PPPOE_SINIT;
1275 /*
1276 * Reset the packet header to broadcast. Since we are
1277 * in a client mode use configured ethertype.
1278 */
1279 memcpy((void *)&neg->pkt->pkt_header.eh, &privp->eh,
1280 sizeof(struct ether_header));
1281 neg->pkt->pkt_header.ph.code = PADI_CODE;
1282 init_tags(sp);
1283 insert_tag(sp, &neg->host_uniq.hdr);
1284 insert_tag(sp, &neg->service.hdr);
1285 if (privp->max_payload.data != 0)
1286 insert_tag(sp, &privp->max_payload.hdr);
1287 make_packet(sp);
1288 /*
1289 * Send packet and prepare to retransmit it after timeout.
1290 */
1291 ng_callout(&neg->handle, node, hook, PPPOE_INITIAL_TIMEOUT * hz,
1292 pppoe_ticker, NULL, 0);
1293 neg->timeout = PPPOE_INITIAL_TIMEOUT * 2;
1294 m0 = m_copypacket(neg->m, M_NOWAIT);
1295 NG_SEND_DATA_ONLY(error, privp->ethernet_hook, m0);
1296}
1297
1298static int
1299send_acname(sessp sp, const struct pppoe_tag *tag)

Callers 2

ng_pppoe_rcvmsgFunction · 0.85
pppoe_tickerFunction · 0.85

Calls 6

init_tagsFunction · 0.85
insert_tagFunction · 0.85
make_packetFunction · 0.85
m_copypacketFunction · 0.85
ng_calloutFunction · 0.70
memcpyFunction · 0.50

Tested by

no test coverage detected