3200N/A#
3200N/A# This patch was devleloped in house. The changes have been fed
3200N/A# upstream and were merged into the-tcpdump-group/libpcap. This
3200N/A# was committed under 2f9790bd3cfe56c0f78d10953571dc4b34060e4f.
3200N/A#
3200N/A# libpcap-1.7.0 is the projected release which will include this
3200N/A# change.
3200N/A#
3200N/A--- libpcap-1.5.1/pcap-bpf.c 2014-08-14 16:14:46.837979600 +0100
3200N/A+++ libpcap-1.5.1/pcap-bpf.c 2014-08-18 15:13:20.805460460 +0100
3200N/A@@ -1539,22 +1539,43 @@
3200N/A
3200N/A #if defined(LIFNAMSIZ) && defined(ZONENAME_MAX) && defined(lifr_zoneid)
3200N/A /*
3200N/A+ * Retrieve the zoneid of the zone we are currently executing in.
3200N/A+ */
3200N/A+ if ((ifr.lifr_zoneid = getzoneid()) == -1) {
3200N/A+ snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "getzoneid(): %s",
3200N/A+ pcap_strerror(errno));
3200N/A+ status = PCAP_ERROR;
3200N/A+ goto bad;
3200N/A+ }
3200N/A+ /*
3200N/A * Check if the given source network device has a '/' separated
3200N/A- * zonename prefix string. The zonename prefixed source device
3200N/A- * can be used by libpcap consumers to capture network traffic
3200N/A- * in non-global zones from the global zone on Solaris 11 and
3200N/A- * above. If the zonename prefix is present then we strip the
3200N/A- * prefix and pass the zone ID as part of lifr_zoneid.
3200N/A+ * zonename prefix string. The zonename prefixed source device can
3200N/A+ * be used by pcap consumers in the Solaris global zone to capture
3200N/A+ * traffic on datalinks in non-global zones. Non-global zones
3200N/A+ * do not have access to datalinks outside of their own namespace.
3200N/A */
3200N/A if ((zonesep = strchr(p->opt.source, '/')) != NULL) {
3200N/A- char zonename[ZONENAME_MAX];
3200N/A+ char path_zname[ZONENAME_MAX];
3200N/A int znamelen;
3200N/A char *lnamep;
3200N/A
3200N/A+ if (ifr.lifr_zoneid != GLOBAL_ZONEID) {
3200N/A+ snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
3200N/A+ "zonename/linkname only valid in global zone.");
3200N/A+ status = PCAP_ERROR;
3200N/A+ goto bad;
3200N/A+ }
3200N/A znamelen = zonesep - p->opt.source;
3200N/A- (void) strlcpy(zonename, p->opt.source, znamelen + 1);
3200N/A+ (void) strlcpy(path_zname, p->opt.source, znamelen + 1);
3200N/A+ ifr.lifr_zoneid = getzoneidbyname(path_zname);
3200N/A+ if (ifr.lifr_zoneid == -1) {
3200N/A+ snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
3200N/A+ "getzoneidbyname(%s): %s", path_zname,
3200N/A+ pcap_strerror(errno));
3200N/A+ status = PCAP_ERROR;
3200N/A+ goto bad;
3200N/A+ }
3200N/A lnamep = strdup(zonesep + 1);
3200N/A- ifr.lifr_zoneid = getzoneidbyname(zonename);
3200N/A free(p->opt.source);
3200N/A p->opt.source = lnamep;
3200N/A }