1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
--- agent/mibgroup/mibII/ipv6.c.orig Fri Feb 28 18:13:36 2003
+++ agent/mibgroup/mibII/ipv6.c Wed Nov 19 00:16:27 2003
@@ -1238,6 +1238,7 @@
if (!auto_nlist("udb6", (char *) &udb6, sizeof(udb6)))
return NULL;
p = (caddr_t) udb6.in6p_next;
+ DEBUGMSGTL(("mibII/ipv6", "start: p=%x\n", p));
#else
{
const char *udblist = "net.inet.udp.pcblist";
@@ -1254,11 +1255,11 @@
oxig = (struct xinpgen *) sysctl_buf;
xig = (struct xinpgen *) ((char *) oxig + oxig->xig_len);
}
+ DEBUGMSGTL(("mibII/ipv6", "start: xig=%p\n", xig));
#endif
found = hitnext = 0;
memcpy((char *) newname, (char *) vp->name,
(int) vp->namelen * sizeof(oid));
- DEBUGMSGTL(("mibII/ipv6", "start: p=%x\n", p));
while (
#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
p && (u_long) p != auto_nlist_value("udb6")
@@ -1266,12 +1267,16 @@
xig->xig_len > sizeof(struct xinpgen)
#endif
) {
- DEBUGMSGTL(("mibII/ipv6", "looping: p=%x\n", p));
#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+ DEBUGMSGTL(("mibII/ipv6", "looping: p=%x\n", p));
klookup((u_long) p, (char *) &in6pcb, sizeof(in6pcb));
#else
in6pcb = ((struct xinpcb *) xig)->xi_inp;
+ if (!(in6pcb.inp_vflag & 0x02)) { /* Skip non-IPv6 pcb */
+ xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
+ continue;
+ }
#endif
j = (int) vp->namelen;
for (i = 0; i < sizeof(struct in6_addr); i++)
@@ -1283,8 +1288,8 @@
else
newname[j++] = 0;
/*XXX*/
- DEBUGMSGTL(("mibII/ipv6", "var_udp6 new: %d %d ",
- (int) vp->namelen, j));
+ DEBUGMSGTL(("mibII/ipv6", "var_udp6 new: %d %d ",
+ (int) vp->namelen, j));
DEBUGMSGOID(("mibII/ipv6", newname, j));
DEBUGMSG(("mibII/ipv6", " %d\n", exact));
@@ -1447,9 +1452,6 @@
p));
break;
}
-#else
- in6pcb = ((struct xinpcb *) xig)->xi_inp;
-#endif
if (klookup
((u_long) in6pcb.in6p_ppcb, (char *) &tcp6cb, sizeof(tcp6cb))
< 0) {
@@ -1457,6 +1459,14 @@
in6pcb.in6p_ppcb));
break;
}
+#else
+ in6pcb = ((struct xinpcb *) xig)->xi_inp;
+ struct xtcpcb *xp = (struct xtcpcb *)xig;
+ tcp6cb = xp->xt_tp;
+ if (!(in6pcb.inp_vflag & 0x02)) { /* Skip non-IPv6 pcb */
+ goto skip;
+ }
+#endif
j = (int) vp->namelen;
for (i = 0; i < sizeof(struct in6_addr); i++)
newname[j++] = in6pcb.in6p_laddr.s6_addr[i];
@@ -1590,6 +1600,7 @@
#if defined(__FreeBSD__) && __FreeBSD__ >= 3
char *sysctl_buf;
struct xinpgen *xig, *oxig;
+ struct xtcpcb *xp;
#endif /* defined(__FreeBSD__) && __FreeBSD__ >= 3 */
if (!initialized) {
@@ -1646,11 +1657,7 @@
DEBUGMSGTL(("mibII/ipv6", "looping: p=%x\n", p));
#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
- if (klookup((u_long) p, (char *) &in6pcb, sizeof(in6pcb)) < 0)
-#else
- in6pcb = ((struct xinpcb *) xig)->xi_inp;
-#endif
- {
+ if (klookup((u_long) p, (char *) &in6pcb, sizeof(in6pcb)) < 0) {
DEBUGMSGTL(("mibII/ipv6", "klookup fail for in6pcb at %x\n",
p));
break;
@@ -1662,6 +1669,14 @@
in6pcb.in6p_ppcb));
break;
}
+#else
+ in6pcb = ((struct xinpcb *) xig)->xi_inp;
+ xp = (struct xtcpcb *)xig;
+ tcp6cb = xp->xt_tp;
+ if (!(in6pcb.inp_vflag & 0x02)) { /* Skip non-IPv6 pcb */
+ goto skip;
+ }
+#endif
j = (int) vp->namelen;
for (i = 0; i < sizeof(struct in6_addr); i++)
newname[j++] = in6pcb.in6p_laddr.s6_addr[i];
|