Author: markj
Date: Wed May 14 19:02:00 2014
New Revision: 266082
URL: http://svnweb.freebsd.org/changeset/base/266082

Log:
  Bind ip/tcp/udp provider translators and symbols to the same versions as in
  illumos, rather than using "1.0" everywhere.
  
  Some of the translators use D functions that are not present in version
  1.0 (e.g. inet_ntoa()) which can result in libdtrace crashing when running
  scripts that restrict themselves to version 1.0
  (e.g. with "-x version=1.0").
  
  MFC after:    1 week

Modified:
  head/cddl/lib/libdtrace/ip.d
  head/cddl/lib/libdtrace/tcp.d
  head/cddl/lib/libdtrace/udp.d

Modified: head/cddl/lib/libdtrace/ip.d
==============================================================================
--- head/cddl/lib/libdtrace/ip.d        Wed May 14 19:00:01 2014        
(r266081)
+++ head/cddl/lib/libdtrace/ip.d        Wed May 14 19:02:00 2014        
(r266082)
@@ -125,53 +125,53 @@ typedef struct ipv6info {
        ip6_t *ipv6_hdr;                /* pointer to raw header */
 } ipv6info_t;
 
-#pragma D binding "1.0" IPPROTO_IP
+#pragma D binding "1.5" IPPROTO_IP
 inline short IPPROTO_IP =      0;
-#pragma D binding "1.0" IPPROTO_ICMP
+#pragma D binding "1.5" IPPROTO_ICMP
 inline short IPPROTO_ICMP =    1;
-#pragma D binding "1.0" IPPROTO_IGMP
+#pragma D binding "1.5" IPPROTO_IGMP
 inline short IPPROTO_IGMP =    2;
-#pragma D binding "1.0" IPPROTO_IPV4
+#pragma D binding "1.5" IPPROTO_IPV4
 inline short IPPROTO_IPV4 =    4;
-#pragma D binding "1.0" IPPROTO_TCP
+#pragma D binding "1.5" IPPROTO_TCP
 inline short IPPROTO_TCP =     6;
-#pragma D binding "1.0" IPPROTO_UDP
+#pragma D binding "1.5" IPPROTO_UDP
 inline short IPPROTO_UDP =     17;
-#pragma D binding "1.0" IPPROTO_IPV6
+#pragma D binding "1.5" IPPROTO_IPV6
 inline short IPPROTO_IPV6 =    41;
-#pragma D binding "1.0" IPPROTO_ROUTING
+#pragma D binding "1.5" IPPROTO_ROUTING
 inline short IPPROTO_ROUTING = 43;
-#pragma D binding "1.0" IPPROTO_FRAGMENT
+#pragma D binding "1.5" IPPROTO_FRAGMENT
 inline short IPPROTO_FRAGMENT =        44;
-#pragma D binding "1.0" IPPROTO_RSVP
+#pragma D binding "1.5" IPPROTO_RSVP
 inline short IPPROTO_RSVP =    46;
-#pragma D binding "1.0" IPPROTO_GRE
+#pragma D binding "1.5" IPPROTO_GRE
 inline short IPPROTO_GRE =     47;
-#pragma D binding "1.0" IPPROTO_ESP
+#pragma D binding "1.5" IPPROTO_ESP
 inline short IPPROTO_ESP =     50;
-#pragma D binding "1.0" IPPROTO_AH
+#pragma D binding "1.5" IPPROTO_AH
 inline short IPPROTO_AH =      51;
-#pragma D binding "1.0" IPPROTO_MOBILE
+#pragma D binding "1.5" IPPROTO_MOBILE
 inline short IPPROTO_MOBILE =  55;
-#pragma D binding "1.0" IPPROTO_ICMPV6
+#pragma D binding "1.5" IPPROTO_ICMPV6
 inline short IPPROTO_ICMPV6 =  58;
-#pragma D binding "1.0" IPPROTO_DSTOPTS
+#pragma D binding "1.5" IPPROTO_DSTOPTS
 inline short IPPROTO_DSTOPTS = 60;
-#pragma D binding "1.0" IPPROTO_ETHERIP
+#pragma D binding "1.5" IPPROTO_ETHERIP
 inline short IPPROTO_ETHERIP = 97;
-#pragma D binding "1.0" IPPROTO_PIM
+#pragma D binding "1.5" IPPROTO_PIM
 inline short IPPROTO_PIM =     103;
-#pragma D binding "1.0" IPPROTO_IPCOMP
+#pragma D binding "1.5" IPPROTO_IPCOMP
 inline short IPPROTO_IPCOMP =  108;
-#pragma D binding "1.0" IPPROTO_SCTP
+#pragma D binding "1.5" IPPROTO_SCTP
 inline short IPPROTO_SCTP =    132;
-#pragma D binding "1.0" IPPROTO_RAW
+#pragma D binding "1.5" IPPROTO_RAW
 inline short IPPROTO_RAW =     255;
 
 inline uint8_t INP_IPV4        = 0x01;
 inline uint8_t INP_IPV6 = 0x02;
 
-#pragma D binding "1.0" protocols
+#pragma D binding "1.5" protocols
 inline string protocols[int proto] =
        proto == IPPROTO_IP ? "IP" :
        proto == IPPROTO_ICMP ? "ICMP" :
@@ -200,12 +200,12 @@ inline string protocols[int proto] =
  * This field is always NULL according to the current definition of the ip
  * probes.
  */
-#pragma D binding "1.0" translator
+#pragma D binding "1.5" translator
 translator pktinfo_t < void *p > {
        pkt_addr =      NULL;
 };
 
-#pragma D binding "1.0" translator
+#pragma D binding "1.5" translator
 translator csinfo_t < void *p > {
        cs_addr =       NULL;
        cs_cid =        (uint64_t)p;
@@ -213,7 +213,7 @@ translator csinfo_t < void *p > {
        cs_zoneid =     0;
 };
 
-#pragma D binding "1.0" translator
+#pragma D binding "1.6.3" translator
 translator csinfo_t < struct inpcb *p > {
        cs_addr =       NULL;
        cs_cid =        (uint64_t)p;
@@ -221,7 +221,7 @@ translator csinfo_t < struct inpcb *p > 
        cs_zoneid =     0;
 };
 
-#pragma D binding "1.0" translator
+#pragma D binding "1.5" translator
 translator ipinfo_t < uint8_t *p > {
        ip_ver =        p == NULL ? 0 : ((struct ip *)p)->ip_v;
        ip_plength =    p == NULL ? 0 :
@@ -238,17 +238,17 @@ translator ipinfo_t < uint8_t *p > {
            inet_ntoa6(&((struct ip6_hdr *)p)->ip6_dst);
 };
 
-#pragma D binding "1.0" IFF_LOOPBACK
+#pragma D binding "1.5" IFF_LOOPBACK
 inline int IFF_LOOPBACK =      0x8;
 
-#pragma D binding "1.0" translator
+#pragma D binding "1.5" translator
 translator ifinfo_t < struct ifnet *p > {
        if_name =       p->if_xname;
        if_local =      (p->if_flags & IFF_LOOPBACK) == 0 ? 0 : 1;
        if_addr =       (uintptr_t)p;
 };
 
-#pragma D binding "1.0" translator
+#pragma D binding "1.5" translator
 translator ipv4info_t < struct ip *p > {
        ipv4_ver =      p == NULL ? 0 : p->ip_v;
        ipv4_ihl =      p == NULL ? 0 : p->ip_hl;
@@ -268,7 +268,7 @@ translator ipv4info_t < struct ip *p > {
        ipv4_hdr =      (ipha_t *)p;
 };
 
-#pragma D binding "1.0" translator
+#pragma D binding "1.5" translator
 translator ipv6info_t < struct ip6_hdr *p > {
        ipv6_ver =      p == NULL ? 0 : 
(ntohl(p->ip6_ctlun.ip6_un1.ip6_un1_flow) & 0xf0000000) >> 28;
        ipv6_tclass =   p == NULL ? 0 : 
(ntohl(p->ip6_ctlun.ip6_un1.ip6_un1_flow) & 0x0ff00000) >> 20;

Modified: head/cddl/lib/libdtrace/tcp.d
==============================================================================
--- head/cddl/lib/libdtrace/tcp.d       Wed May 14 19:00:01 2014        
(r266081)
+++ head/cddl/lib/libdtrace/tcp.d       Wed May 14 19:02:00 2014        
(r266082)
@@ -31,49 +31,49 @@
 /*
  * Convert a TCP state value to a string.
  */
-#pragma D binding "1.0" TCPS_CLOSED
+#pragma D binding "1.6.3" TCPS_CLOSED
 inline int TCPS_CLOSED =       0;
-#pragma D binding "1.0" TCPS_LISTEN
+#pragma D binding "1.6.3" TCPS_LISTEN
 inline int TCPS_LISTEN =       1;
-#pragma D binding "1.0" TCPS_SYN_SENT
+#pragma D binding "1.6.3" TCPS_SYN_SENT
 inline int TCPS_SYN_SENT =     2;
-#pragma D binding "1.0" TCPS_SYN_RECEIVED
+#pragma D binding "1.6.3" TCPS_SYN_RECEIVED
 inline int TCPS_SYN_RECEIVED = 3;
-#pragma D binding "1.0" TCPS_ESTABLISHED
+#pragma D binding "1.6.3" TCPS_ESTABLISHED
 inline int TCPS_ESTABLISHED =  4;
-#pragma D binding "1.0" TCPS_CLOSE_WAIT
+#pragma D binding "1.6.3" TCPS_CLOSE_WAIT
 inline int TCPS_CLOSE_WAIT =   5;
-#pragma D binding "1.0" TCPS_FIN_WAIT_1
+#pragma D binding "1.6.3" TCPS_FIN_WAIT_1
 inline int TCPS_FIN_WAIT_1 =   6;
-#pragma D binding "1.0" TCPS_CLOSING
+#pragma D binding "1.6.3" TCPS_CLOSING
 inline int TCPS_CLOSING =      7;
-#pragma D binding "1.0" TCPS_LAST_ACK
+#pragma D binding "1.6.3" TCPS_LAST_ACK
 inline int TCPS_LAST_ACK =     8;
-#pragma D binding "1.0" TCPS_FIN_WAIT_2
+#pragma D binding "1.6.3" TCPS_FIN_WAIT_2
 inline int TCPS_FIN_WAIT_2 =   9;
-#pragma D binding "1.0" TCPS_TIME_WAIT
+#pragma D binding "1.6.3" TCPS_TIME_WAIT
 inline int TCPS_TIME_WAIT =    10;
 
 /* TCP segment flags. */
-#pragma D binding "1.0" TH_FIN
+#pragma D binding "1.6.3" TH_FIN
 inline uint8_t TH_FIN =                0x01;
-#pragma D binding "1.0" TH_SYN
+#pragma D binding "1.6.3" TH_SYN
 inline uint8_t TH_SYN =                0x02;
-#pragma D binding "1.0" TH_RST
+#pragma D binding "1.6.3" TH_RST
 inline uint8_t TH_RST =                0x04;
-#pragma D binding "1.0" TH_PUSH
+#pragma D binding "1.6.3" TH_PUSH
 inline uint8_t TH_PUSH =       0x08;
-#pragma D binding "1.0" TH_ACK
+#pragma D binding "1.6.3" TH_ACK
 inline uint8_t TH_ACK =                0x10;
-#pragma D binding "1.0" TH_URG
+#pragma D binding "1.6.3" TH_URG
 inline uint8_t TH_URG =                0x20;
-#pragma D binding "1.0" TH_ECE
+#pragma D binding "1.6.3" TH_ECE
 inline uint8_t TH_ECE =                0x40;
-#pragma D binding "1.0" TH_CWR
+#pragma D binding "1.6.3" TH_CWR
 inline uint8_t TH_CWR =                0x80;
 
 /* TCP connection state strings. */
-#pragma D binding "1.0" tcp_state_string
+#pragma D binding "1.6.3" tcp_state_string
 inline string tcp_state_string[int32_t state] =
        state == TCPS_CLOSED ?          "state-closed" :
        state == TCPS_LISTEN ?          "state-listen" :
@@ -160,7 +160,7 @@ typedef struct tcpinfoh {
        struct tcphdr *tcp_hdr;         /* raw TCP header */
 } tcpinfoh_t;
 
-#pragma D binding "1.0" translator
+#pragma D binding "1.6.3" translator
 translator csinfo_t < struct tcpcb *p > {
        cs_addr =       NULL;
        cs_cid =        (uint64_t)(p == NULL ? 0 : p->t_inpcb);
@@ -168,7 +168,7 @@ translator csinfo_t < struct tcpcb *p > 
        cs_zoneid =     0;
 };
 
-#pragma D binding "1.0" translator
+#pragma D binding "1.6.3" translator
 translator tcpsinfo_t < struct tcpcb *p > {
        tcps_addr =             (uintptr_t)p;
        tcps_local =            -1; /* XXX */
@@ -202,7 +202,7 @@ translator tcpsinfo_t < struct tcpcb *p 
        tcps_retransmit =       p == NULL ? -1 : p->t_rxtshift > 0 ? 1 : 0;
 };
 
-#pragma D binding "1.0" translator
+#pragma D binding "1.6.3" translator
 translator tcpinfo_t < struct tcphdr *p > {
        tcp_sport =     p == NULL ? 0  : ntohs(p->th_sport);
        tcp_dport =     p == NULL ? 0  : ntohs(p->th_dport);
@@ -221,7 +221,7 @@ translator tcpinfo_t < struct tcphdr *p 
  * number, acknowledgement number, window size and urgent pointer are already
  * in host order and thus don't need to be converted.
  */
-#pragma D binding "1.0" translator
+#pragma D binding "1.6.3" translator
 translator tcpinfoh_t < struct tcphdr *p > {
        tcp_sport =     p == NULL ? 0  : ntohs(p->th_sport);
        tcp_dport =     p == NULL ? 0  : ntohs(p->th_dport);
@@ -235,7 +235,7 @@ translator tcpinfoh_t < struct tcphdr *p
        tcp_hdr =       (struct tcphdr *)p;
 };
 
-#pragma D binding "1.0" translator
+#pragma D binding "1.6.3" translator
 translator tcplsinfo_t < int s > {
        tcps_state =    s;
 };

Modified: head/cddl/lib/libdtrace/udp.d
==============================================================================
--- head/cddl/lib/libdtrace/udp.d       Wed May 14 19:00:01 2014        
(r266081)
+++ head/cddl/lib/libdtrace/udp.d       Wed May 14 19:02:00 2014        
(r266082)
@@ -50,7 +50,7 @@ typedef struct udpinfo {
        struct udphdr *udp_hdr;         /* raw UDP header */
 } udpinfo_t;
 
-#pragma D binding "1.0" translator
+#pragma D binding "1.6.3" translator
 translator udpsinfo_t < struct inpcb *p > {
        udps_addr =     (uintptr_t)p;
        udps_lport =    p == NULL ? 0 : ntohs(p->inp_inc.inc_ie.ie_lport);
@@ -65,7 +65,7 @@ translator udpsinfo_t < struct inpcb *p 
            inet_ntoa6(&p->inp_inc.inc_ie.ie_dependfaddr.ie6_foreign);
 };
 
-#pragma D binding "1.0" translator
+#pragma D binding "1.6.3" translator
 translator udpinfo_t < struct udphdr *p > {
        udp_sport =     p == NULL ? 0 : ntohs(p->uh_sport);
        udp_dport =     p == NULL ? 0 : ntohs(p->uh_dport);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to