Make ng_ppp fulfill upper protocol stack layers alignment requirements

on platforms with strict alignment constraints.
This fixes kernel panics on arm and probably other architectures.

PR:		sparc64/80410
This commit is contained in:
Alexander Motin 2010-03-31 20:37:44 +00:00
parent 883e8983aa
commit d6b013b537
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=206000

View File

@ -907,7 +907,21 @@ ng_ppp_proto_recv(node_p node, item_p item, uint16_t proto, uint16_t linkNum)
const priv_p priv = NG_NODE_PRIVATE(node);
hook_p outHook = NULL;
int error;
#ifdef ALIGNED_POINTER
struct mbuf *m, *n;
NGI_GET_M(item, m);
if (!ALIGNED_POINTER(mtod(m, caddr_t), uint32_t)) {
n = m_defrag(m, M_NOWAIT);
if (n == NULL) {
m_freem(m);
NG_FREE_ITEM(item);
return (ENOBUFS);
}
m = n;
}
NGI_M(item) = m;
#endif /* ALIGNED_POINTER */
switch (proto) {
case PROT_IP:
if (priv->conf.enableIP)