ip_encap.c (95023) | ip_encap.c (105194) |
---|---|
1/* $FreeBSD: head/sys/netinet/ip_encap.c 95023 2002-04-19 04:46:24Z suz $ */ | 1/* $FreeBSD: head/sys/netinet/ip_encap.c 105194 2002-10-16 01:54:46Z sam $ */ |
2/* $KAME: ip_encap.c,v 1.41 2001/03/15 08:35:08 itojun Exp $ */ 3 4/* 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 470 unchanged lines hidden (view full) --- 480 return 0; 481} 482 483static void 484encap_fillarg(m, ep) 485 struct mbuf *m; 486 const struct encaptab *ep; 487{ | 2/* $KAME: ip_encap.c,v 1.41 2001/03/15 08:35:08 itojun Exp $ */ 3 4/* 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 470 unchanged lines hidden (view full) --- 480 return 0; 481} 482 483static void 484encap_fillarg(m, ep) 485 struct mbuf *m; 486 const struct encaptab *ep; 487{ |
488#if 0 489 m->m_pkthdr.aux = ep->arg; 490#else 491 struct mbuf *n; | 488 struct m_tag *tag; |
492 | 489 |
493 n = m_aux_add(m, AF_INET, IPPROTO_IPV4); 494 if (n) { 495 *mtod(n, void **) = ep->arg; 496 n->m_len = sizeof(void *); | 490 tag = m_tag_get(PACKET_TAG_ENCAP, sizeof (void*), M_NOWAIT); 491 if (tag) { 492 *(void**)(tag+1) = ep->arg; 493 m_tag_prepend(m, tag); |
497 } | 494 } |
498#endif | |
499} 500 501void * 502encap_getarg(m) 503 struct mbuf *m; 504{ | 495} 496 497void * 498encap_getarg(m) 499 struct mbuf *m; 500{ |
505 void *p; 506#if 0 507 p = m->m_pkthdr.aux; 508 m->m_pkthdr.aux = NULL; 509 return p; 510#else 511 struct mbuf *n; | 501 void *p = NULL; 502 struct m_tag *tag; |
512 | 503 |
513 p = NULL; 514 n = m_aux_find(m, AF_INET, IPPROTO_IPV4); 515 if (n) { 516 if (n->m_len == sizeof(void *)) 517 p = *mtod(n, void **); 518 m_aux_delete(m, n); | 504 tag = m_tag_find(m, PACKET_TAG_ENCAP, NULL); 505 if (tag) { 506 p = *(void**)(tag+1); 507 m_tag_delete(m, tag); |
519 } 520 return p; | 508 } 509 return p; |
521#endif | |
522} | 510} |