Skip to content

Commit

Permalink
Fix token_rif extractions from llentry
Browse files Browse the repository at this point in the history
  • Loading branch information
ozaki-r committed Dec 16, 2015
1 parent aec035b commit f075bd6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
8 changes: 5 additions & 3 deletions sys/net/if_token.h
@@ -1,4 +1,4 @@
/* $NetBSD: if_token.h,v 1.16 2008/02/20 17:05:53 matt Exp $ */
/* $NetBSD: if_token.h,v 1.17 2015/12/16 05:44:59 ozaki-r Exp $ */

/*
* Copyright (c) 1982, 1986, 1993
Expand Down Expand Up @@ -95,11 +95,13 @@ struct token_rif {
#define ISO88025_MTU 2002

/*
* This assumes that route information fields are appended to
* existing structures like llinfo_arp and token_header
* This assumes that route information fields are appended to token_header.
*/
#define TOKEN_RIF(x) ((struct token_rif *) ((x) + 1))

#define TOKEN_RIF_LLE(lle) ((struct token_rif *) (lle)->la_opaque)
#define TOKEN_RIF_LLE_ASSERT(lle) KASSERT((lle)->la_opaque != NULL)

/*
* This is a kludge to get at the token ring mac header and the source route
* information after m_adj() has been used on the mbuf.
Expand Down
8 changes: 4 additions & 4 deletions sys/net/if_tokensubr.c
@@ -1,4 +1,4 @@
/* $NetBSD: if_tokensubr.c,v 1.71 2015/08/31 08:05:20 ozaki-r Exp $ */
/* $NetBSD: if_tokensubr.c,v 1.72 2015/12/16 05:44:59 ozaki-r Exp $ */

/*
* Copyright (c) 1982, 1989, 1993
Expand Down Expand Up @@ -92,7 +92,7 @@
*/

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_tokensubr.c,v 1.71 2015/08/31 08:05:20 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_tokensubr.c,v 1.72 2015/12/16 05:44:59 ozaki-r Exp $");

#ifdef _KERNEL_OPT
#include "opt_inet.h"
Expand Down Expand Up @@ -223,8 +223,8 @@ token_output(struct ifnet *ifp0, struct mbuf *m0, const struct sockaddr *dst,
return (0); /* if not yet resolved */
la = rt->rt_llinfo;
KASSERT(la != NULL);
KASSERT(la->la_opaque != NULL);
rif = la->la_opaque;
TOKEN_RIF_LLE_ASSERT(la);
rif = TOKEN_RIF_LLE(la);
riflen = (ntohs(rif->tr_rcf) & TOKEN_RCF_LEN_MASK) >> 8;
}
/* If broadcasting on a simplex interface, loopback a copy. */
Expand Down
6 changes: 3 additions & 3 deletions sys/netinet/if_arp.c
@@ -1,4 +1,4 @@
/* $NetBSD: if_arp.c,v 1.196 2015/12/11 01:15:00 ozaki-r Exp $ */
/* $NetBSD: if_arp.c,v 1.197 2015/12/16 05:44:59 ozaki-r Exp $ */

/*-
* Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
Expand Down Expand Up @@ -68,7 +68,7 @@
*/

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.196 2015/12/11 01:15:00 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.197 2015/12/16 05:44:59 ozaki-r Exp $");

#ifdef _KERNEL_OPT
#include "opt_ddb.h"
Expand Down Expand Up @@ -1336,7 +1336,7 @@ in_arpinput(struct mbuf *m)
(riflen & 1) == 0) {
rif->tr_rcf ^= htons(TOKEN_RCF_DIRECTION);
rif->tr_rcf &= htons(~TOKEN_RCF_BROADCAST_MASK);
memcpy(TOKEN_RIF(la), rif, riflen);
memcpy(TOKEN_RIF_LLE(la), rif, riflen);
}
}
}
Expand Down

0 comments on commit f075bd6

Please sign in to comment.