* Start a client into the first state. A separate function because * it can be needed if the negotiation times out. */
| 1258 | * it can be needed if the negotiation times out. |
| 1259 | */ |
| 1260 | static void |
| 1261 | pppoe_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 | |
| 1298 | static int |
| 1299 | send_acname(sessp sp, const struct pppoe_tag *tag) |
no test coverage detected