Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Aug 2018 17:09:41 +0000 (UTC)
From:      Marcin Wojtas <mw@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r338351 - head/sys/dev/al_eth
Message-ID:  <201808281709.w7SH9fQK062597@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mw
Date: Tue Aug 28 17:09:41 2018
New Revision: 338351
URL: https://svnweb.freebsd.org/changeset/base/338351

Log:
  Use ip/ipv6 structures in al_eth only if they are supported
  
  The ip/ipv6 header files are included only if the appropriate definition
  exists, but the driver was missing similar checks when using the
  ip and ip6_hdr structures.
  
  If the kernel was not built with the INET or INET6 option, the driver
  was preventing kernel from being built.
  
  To fix that, the missing ifdef checks were added to the driver.
  
  PR: Bug 230886
  Submitted by: Michal Krawczyk <mk@semihalf.com>
  Reported by: O. Hartmann
  Approved by: re (gjb)
  Obtained from: Semihalf
  MFC after: 1 week
  Sponsored by: Amazon, Inc.

Modified:
  head/sys/dev/al_eth/al_eth.c

Modified: head/sys/dev/al_eth/al_eth.c
==============================================================================
--- head/sys/dev/al_eth/al_eth.c	Tue Aug 28 15:18:14 2018	(r338350)
+++ head/sys/dev/al_eth/al_eth.c	Tue Aug 28 17:09:41 2018	(r338351)
@@ -1202,8 +1202,12 @@ al_eth_tx_csum(struct al_eth_ring *tx_ring, struct al_
 	uint32_t mss = m->m_pkthdr.tso_segsz;
 	struct ether_vlan_header *eh;
 	uint16_t etype;
+#ifdef INET
 	struct ip *ip;
+#endif
+#ifdef INET6
 	struct ip6_hdr *ip6;
+#endif
 	struct tcphdr *th = NULL;
 	int	ehdrlen, ip_hlen = 0;
 	uint8_t	ipproto = 0;
@@ -1243,6 +1247,7 @@ al_eth_tx_csum(struct al_eth_ring *tx_ring, struct al_
 		}
 
 		switch (etype) {
+#ifdef INET
 		case ETHERTYPE_IP:
 			ip = (struct ip *)(m->m_data + ehdrlen);
 			ip_hlen = ip->ip_hl << 2;
@@ -1256,6 +1261,8 @@ al_eth_tx_csum(struct al_eth_ring *tx_ring, struct al_
 			else
 				hal_pkt->l4_proto_idx = AL_ETH_PROTO_ID_UDP;
 			break;
+#endif /* INET */
+#ifdef INET6
 		case ETHERTYPE_IPV6:
 			ip6 = (struct ip6_hdr *)(m->m_data + ehdrlen);
 			hal_pkt->l3_proto_idx = AL_ETH_PROTO_ID_IPv6;
@@ -1267,6 +1274,7 @@ al_eth_tx_csum(struct al_eth_ring *tx_ring, struct al_
 			else
 				hal_pkt->l4_proto_idx = AL_ETH_PROTO_ID_UDP;
 			break;
+#endif /* INET6 */
 		default:
 			break;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808281709.w7SH9fQK062597>