diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2001-06-23 21:32:27 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2001-06-23 21:32:27 +0000 |
commit | c0092311ffa0074642cf2776cf72aad553099229 (patch) | |
tree | 4a3a6129bd4fe63d0ec0630f944db6e6c380b583 | |
parent | 63e450328a0f91570c0a79aa9e9be81df9cd32b8 (diff) |
Put some constants together and calculate max/min mtu based on those;
jason@ ok.
This should be moved to net, tho, it's not inet specific.
-rw-r--r-- | sys/netinet/if_ether.h | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/sys/netinet/if_ether.h b/sys/netinet/if_ether.h index 365e94c6da5..7abd64b245a 100644 --- a/sys/netinet/if_ether.h +++ b/sys/netinet/if_ether.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.h,v 1.15 2001/06/09 06:14:32 angelos Exp $ */ +/* $OpenBSD: if_ether.h,v 1.16 2001/06/23 21:32:26 fgsch Exp $ */ /* $NetBSD: if_ether.h,v 1.22 1996/05/11 13:00:00 mycroft Exp $ */ /* @@ -48,24 +48,18 @@ struct ether_addr { }; /* - * Structure of a Ethernet header. + * Some Ethernet constants. */ -#define ETHER_ADDR_LEN 6 - -/* - * The number of bytes in the type field. - */ -#define ETHER_TYPE_LEN 2 - -/* - * The number of bytes in the trailing CRC field. - */ -#define ETHER_CRC_LEN 4 +#define ETHER_ADDR_LEN 6 /* Ethernet address length */ +#define ETHER_TYPE_LEN 2 /* Ethernet type field length */ +#define ETHER_CRC_LEN 4 /* Ethernet CRC lenght */ +#define ETHER_HDR_LEN ((ETHER_ADDR_LEN * 2) + ETHER_TYPE_LEN) +#define ETHER_MIN_LEN 64 /* Minimum frame length, CRC included */ +#define ETHER_MAX_LEN 1518 /* Maximum frame length, CRC included */ /* * The length of the combined header. */ -#define ETHER_HDR_LEN (ETHER_ADDR_LEN*2+ETHER_TYPE_LEN) struct ether_header { u_int8_t ether_dhost[ETHER_ADDR_LEN]; @@ -93,8 +87,8 @@ struct ether_header { #define ETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address mcast/bcast? */ -#define ETHERMTU 1500 -#define ETHERMIN (60-14) +#define ETHERMTU (ETHER_MAX_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN) +#define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN) #ifdef _KERNEL /* |