| 307 | } |
| 308 | |
| 309 | static int |
| 310 | in_gif_input(struct mbuf *m, int off, int proto, void *arg) |
| 311 | { |
| 312 | struct gif_softc *sc = arg; |
| 313 | struct ifnet *gifp; |
| 314 | struct ip *ip; |
| 315 | uint8_t ecn; |
| 316 | |
| 317 | NET_EPOCH_ASSERT(); |
| 318 | if (sc == NULL) { |
| 319 | m_freem(m); |
| 320 | KMOD_IPSTAT_INC(ips_nogif); |
| 321 | return (IPPROTO_DONE); |
| 322 | } |
| 323 | gifp = GIF2IFP(sc); |
| 324 | if ((gifp->if_flags & IFF_UP) != 0) { |
| 325 | ip = mtod(m, struct ip *); |
| 326 | ecn = ip->ip_tos; |
| 327 | m_adj(m, off); |
| 328 | gif_input(m, gifp, proto, ecn); |
| 329 | } else { |
| 330 | m_freem(m); |
| 331 | KMOD_IPSTAT_INC(ips_nogif); |
| 332 | } |
| 333 | return (IPPROTO_DONE); |
| 334 | } |
| 335 | |
| 336 | static int |
| 337 | in_gif_lookup(const struct mbuf *m, int off, int proto, void **arg) |