[PATCH] utils: Update link layer protocol translations

Tobias Klauser tklauser at distanz.ch
Tue May 19 04:40:24 PDT 2015


Update the private copy of linux/if_arp.h and hook up the not yet
defined ARPHRD_* types in the llprotos translation table. Reorder the
entries such that they correspond to the order they're defined in
linux/if_arp.h. Also remove the #ifdef guards since these are
unnecessary given that the private copy of the kernel header is used.

Signed-off-by: Tobias Klauser <tklauser at distanz.ch>
---
 include/linux-private/linux/if_arp.h |  4 ++++
 lib/utils.c                          | 23 +++++++++--------------
 2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/include/linux-private/linux/if_arp.h b/include/linux-private/linux/if_arp.h
index e04cd2c..9a38ea4 100644
--- a/include/linux-private/linux/if_arp.h
+++ b/include/linux-private/linux/if_arp.h
@@ -87,10 +87,14 @@
 #define ARPHRD_IEEE80211_PRISM 802	/* IEEE 802.11 + Prism2 header  */
 #define ARPHRD_IEEE80211_RADIOTAP 803	/* IEEE 802.11 + radiotap header */
 #define ARPHRD_IEEE802154	  804
+#define ARPHRD_IEEE802154_MONITOR 805	/* IEEE 802.15.4 network monitor */
 
 #define ARPHRD_PHONET	820		/* PhoNet media type		*/
 #define ARPHRD_PHONET_PIPE 821		/* PhoNet pipe header		*/
 #define ARPHRD_CAIF	822		/* CAIF media type		*/
+#define ARPHRD_IP6GRE	823		/* GRE over IPv6		*/
+#define ARPHRD_NETLINK	824		/* Netlink header		*/
+#define ARPHRD_6LOWPAN	825		/* IPv6 over LoWPAN             */
 
 #define ARPHRD_VOID	  0xFFFF	/* Void type, nothing is known */
 #define ARPHRD_NONE	  0xFFFE	/* zero header length */
diff --git a/lib/utils.c b/lib/utils.c
index ca11fea..8b99c9f 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -641,9 +641,7 @@ static const struct trans_tbl llprotos[] = {
 	__ADD(ARPHRD_ATM,atm),
 	__ADD(ARPHRD_METRICOM,metricom),
 	__ADD(ARPHRD_IEEE1394,ieee1394),
-#ifdef ARPHRD_EUI64
 	__ADD(ARPHRD_EUI64,eui64),
-#endif
 	__ADD(ARPHRD_INFINIBAND,infiniband),
 	__ADD(ARPHRD_SLIP,slip),
 	__ADD(ARPHRD_CSLIP,cslip),
@@ -653,9 +651,7 @@ static const struct trans_tbl llprotos[] = {
 	__ADD(ARPHRD_ADAPT,adapt),
 	__ADD(ARPHRD_ROSE,rose),
 	__ADD(ARPHRD_X25,x25),
-#ifdef ARPHRD_HWX25
 	__ADD(ARPHRD_HWX25,hwx25),
-#endif
 	__ADD(ARPHRD_CAN,can),
 	__ADD(ARPHRD_PPP,ppp),
 	__ADD(ARPHRD_HDLC,hdlc),
@@ -696,19 +692,18 @@ static const struct trans_tbl llprotos[] = {
 	__ADD(ARPHRD_FCFABRIC+12,fcfb_12),
 	__ADD(ARPHRD_IEEE802_TR,tr),
 	__ADD(ARPHRD_IEEE80211,ieee802.11),
+	__ADD(ARPHRD_IEEE80211_PRISM,ieee802.11_prism),
+	__ADD(ARPHRD_IEEE80211_RADIOTAP,ieee802.11_radiotap),
+	__ADD(ARPHRD_IEEE802154,ieee802.15.4),
+	__ADD(ARPHRD_IEEE802154_MONITOR,ieee802.15.4_monitor),
 	__ADD(ARPHRD_PHONET,phonet),
-#ifdef ARPHRD_CAIF
-	__ADD(ARPHRD_CAIF, caif),
-#endif
-#ifdef ARPHRD_IEEE80211_PRISM
-	__ADD(ARPHRD_IEEE80211_PRISM, ieee802.11_prism),
-#endif
-#ifdef ARPHRD_VOID
+	__ADD(ARPHRD_PHONET_PIPE,phonet_pipe),
+	__ADD(ARPHRD_CAIF,caif),
+	__ADD(ARPHRD_IP6GRE,ip6gre),
+	__ADD(ARPHRD_NETLINK,netlink),
+	__ADD(ARPHRD_6LOWPAN,6lowpan),
 	__ADD(ARPHRD_VOID,void),
-#endif
-#ifdef ARPHRD_NONE
 	__ADD(ARPHRD_NONE,nohdr),
-#endif
 };
 
 char * nl_llproto2str(int llproto, char *buf, size_t len)
-- 
2.2.2





More information about the libnl mailing list