* Timeouts come here. */
| 2098 | * Timeouts come here. |
| 2099 | */ |
| 2100 | static void |
| 2101 | pppoe_ticker(node_p node, hook_p hook, void *arg1, int arg2) |
| 2102 | { |
| 2103 | priv_p privp = NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); |
| 2104 | sessp sp = NG_HOOK_PRIVATE(hook); |
| 2105 | negp neg = sp->neg; |
| 2106 | struct mbuf *m0 = NULL; |
| 2107 | int error = 0; |
| 2108 | |
| 2109 | CTR6(KTR_NET, "%20s: node [%x] (%p) hook \"%s\" (%p) session %d", |
| 2110 | __func__, node->nd_ID, node, hook->hk_name, hook, sp->Session_ID); |
| 2111 | switch(sp->state) { |
| 2112 | /* |
| 2113 | * Resend the last packet, using an exponential backoff. |
| 2114 | * After a period of time, stop growing the backoff, |
| 2115 | * And either leave it, or revert to the start. |
| 2116 | */ |
| 2117 | case PPPOE_SINIT: |
| 2118 | case PPPOE_SREQ: |
| 2119 | /* Timeouts on these produce resends. */ |
| 2120 | m0 = m_copypacket(sp->neg->m, M_NOWAIT); |
| 2121 | NG_SEND_DATA_ONLY( error, privp->ethernet_hook, m0); |
| 2122 | ng_callout(&neg->handle, node, hook, neg->timeout * hz, |
| 2123 | pppoe_ticker, NULL, 0); |
| 2124 | if ((neg->timeout <<= 1) > PPPOE_TIMEOUT_LIMIT) { |
| 2125 | if (sp->state == PPPOE_SREQ) { |
| 2126 | /* Revert to SINIT mode. */ |
| 2127 | pppoe_start(sp); |
| 2128 | } else { |
| 2129 | neg->timeout = PPPOE_TIMEOUT_LIMIT; |
| 2130 | } |
| 2131 | } |
| 2132 | break; |
| 2133 | case PPPOE_PRIMED: |
| 2134 | case PPPOE_SOFFER: |
| 2135 | /* A timeout on these says "give up" */ |
| 2136 | ng_rmhook_self(hook); |
| 2137 | break; |
| 2138 | default: |
| 2139 | /* Timeouts have no meaning in other states. */ |
| 2140 | log(LOG_NOTICE, "ng_pppoe[%x]: unexpected timeout\n", |
| 2141 | node->nd_ID); |
| 2142 | } |
| 2143 | } |
| 2144 | |
| 2145 | /* |
| 2146 | * Parse an incoming packet to see if any tags should be copied to the |
nothing calls this directly
no test coverage detected