diff options
author | 2016-11-29 18:37:02 +0000 | |
---|---|---|
committer | 2016-11-29 18:37:02 +0000 | |
commit | 6b22954c9592090bc121f26d4e8a5ccf85b5e68f (patch) | |
tree | a7f70802698acdcdbc7ce917c006de80c64cd0d3 | |
parent | seperate these descriptions into seperate files to reduce confusion. (diff) | |
download | wireguard-openbsd-6b22954c9592090bc121f26d4e8a5ccf85b5e68f.tar.xz wireguard-openbsd-6b22954c9592090bc121f26d4e8a5ccf85b5e68f.zip |
Stop exporting the eproto_db array, export a pointer to it instead.
tcpdump directly uses eproto_db even though it is not part of the
libpcap API. This means that we can't freely add members to this array,
else ld.so complains about size mismatches. Keep the data in a static
array instead and make it usable by tcpdump through a pointer whose size
won't change in the future. A minor bump is enough here for ld.so to
stop complaining.
While here, mark _eproto_db and llc_db as const, as they are meant to
be.
Suggested by and ok deraadt@
-rw-r--r-- | lib/libpcap/nametoaddr.c | 12 | ||||
-rw-r--r-- | lib/libpcap/shlib_version | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/libpcap/nametoaddr.c b/lib/libpcap/nametoaddr.c index 9eead15f5fe..6ad4339d928 100644 --- a/lib/libpcap/nametoaddr.c +++ b/lib/libpcap/nametoaddr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nametoaddr.c,v 1.19 2015/11/17 21:39:23 mmcc Exp $ */ +/* $OpenBSD: nametoaddr.c,v 1.20 2016/11/29 18:37:02 jca Exp $ */ /* * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996 @@ -193,7 +193,7 @@ struct eproto { }; /* Static data base of ether protocol types. */ -struct eproto eproto_db[] = { +static const struct eproto _eproto_db[] = { { "pup", ETHERTYPE_PUP }, { "xns", ETHERTYPE_NS }, { "ip", ETHERTYPE_IP }, @@ -218,11 +218,13 @@ struct eproto eproto_db[] = { { "decdns", ETHERTYPE_DECDNS }, { (char *)0, 0 } }; +/* Accessor for tcpdump */ +const struct eproto * const eproto_db = _eproto_db; int pcap_nametoeproto(const char *s) { - struct eproto *p = eproto_db; + const struct eproto *p = _eproto_db; while (p->s != 0) { if (strcmp(p->s, s) == 0) @@ -235,7 +237,7 @@ pcap_nametoeproto(const char *s) #include "llc.h" /* Static data base of LLC values. */ -static struct eproto llc_db[] = { +static const struct eproto llc_db[] = { { "stp", LLCSAP_8021D }, { (char *)0, 0 } }; @@ -243,7 +245,7 @@ static struct eproto llc_db[] = { int pcap_nametollc(const char *s) { - struct eproto *p = llc_db; + const struct eproto *p = llc_db; while (p->s != 0) { if (strcmp(p->s, s) == 0) diff --git a/lib/libpcap/shlib_version b/lib/libpcap/shlib_version index 51876cfb75f..f7b871cfc1e 100644 --- a/lib/libpcap/shlib_version +++ b/lib/libpcap/shlib_version @@ -1,2 +1,2 @@ major=8 -minor=2 +minor=3 |