diff options
author | glebius <glebius@FreeBSD.org> | 2005-12-18 18:24:27 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2005-12-18 18:24:27 +0000 |
commit | 175e16aa4df4f5510a7a395b24bd5ac9a00145f9 (patch) | |
tree | edde4e6e448953c23a09236086ca19000c7a4fb5 /sys/net | |
parent | 035fda79903772207b9132abc6ed91ac80535900 (diff) | |
download | FreeBSD-src-175e16aa4df4f5510a7a395b24bd5ac9a00145f9.zip FreeBSD-src-175e16aa4df4f5510a7a395b24bd5ac9a00145f9.tar.gz |
- Fix VLAN_INPUT_TAG() macro, so that it doesn't touch mtag in
case if memory allocation failed.
- Remove fourth argument from VLAN_INPUT_TAG(), that was used
incorrectly in almost all drivers. Indicate failure with
mbuf value of NULL.
In collaboration with: yongari, ru, sam
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if_vlan_var.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/net/if_vlan_var.h b/sys/net/if_vlan_var.h index c55d5d1..b1fecf6 100644 --- a/sys/net/if_vlan_var.h +++ b/sys/net/if_vlan_var.h @@ -102,18 +102,19 @@ struct vlanreq { */ #define VLAN_TAG_VALUE(_mt) (*(u_int *)((_mt) + 1)) -#define VLAN_INPUT_TAG(_ifp, _m, _t, _errcase) do { \ +#define VLAN_INPUT_TAG(_ifp, _m, _t) do { \ struct m_tag *mtag; \ mtag = m_tag_alloc(MTAG_VLAN, MTAG_VLAN_TAG, \ sizeof (u_int), M_NOWAIT); \ - if (mtag == NULL) { \ + if (mtag != NULL) { \ + VLAN_TAG_VALUE(mtag) = (_t); \ + m_tag_prepend((_m), mtag); \ + (_m)->m_flags |= M_VLANTAG; \ + } else { \ (_ifp)->if_ierrors++; \ m_freem(_m); \ - _errcase; \ + _m = NULL; \ } \ - VLAN_TAG_VALUE(mtag) = (_t); \ - m_tag_prepend((_m), mtag); \ - (_m)->m_flags |= M_VLANTAG; \ } while (0) #define VLAN_OUTPUT_TAG(_ifp, _m) \ |