static char b[UNET_NAMEMAX];
struct unet_info uni;
if (ioctl(t->f.fd, UNIOCGINFO, &uni)) {
- a_warn("TUN - unet getinfo-error -- %s", strerror(errno));
+ a_warn("TUN", "-", "unet", "getinfo-error", "?ERRNO", A_END);
return ("<error>");
}
if (strlen(uni.uni_ifname) + 1 > sizeof(b)) {
- a_warn("TUN - unet ifname-too-long");
+ a_warn("TUN", "-", "unet", "ifname-too-long", A_END);
return ("<error>");
}
strcpy(b, uni.uni_ifname);
n = read(fd, buf_i, sizeof(buf_i));
if (n < 0) {
- a_warn("TUN %s read-error -- %s", t_ifname(t), strerror(errno));
+ a_warn("TUN", "%s", t_ifname(t), "read-error", "?ERRNO", A_END);
return;
}
IF_TRACING(T_TUNNEL, {
- trace(T_TUNNEL, "tunnel: packet arrived");
- trace_block(T_PACKET, "tunnel: packet contents", buf_i, n);
+ trace(T_TUNNEL, "tun-unet: packet arrived");
+ trace_block(T_PACKET, "tun-unet: packet contents", buf_i, n);
})
buf_init(&b, buf_i, n);
p_tun(t->p, &b);
int f;
if ((fd = open("/dev/unet", O_RDWR)) < 0) {
- a_warn("TUN - open-error /dev/unet -- %s", strerror(errno));
+ a_warn("TUN", "-", "unet", "open-error", "/dev/unet", "?ERRNO", A_END);
return (0);
}
fdflags(fd, O_NONBLOCK, O_NONBLOCK, FD_CLOEXEC, FD_CLOEXEC);
if ((f = ioctl(fd, UNIOCGIFFLAGS)) < 0 ||
ioctl(fd, UNIOCSIFFLAGS, f | IFF_POINTOPOINT)) {
- a_warn("TUN - unet config-error -- %s", strerror(errno));
+ a_warn("TUN", "-", "unet", "config-error", "?ERRNO", A_END);
close(fd);
return (0);
}
t->p = p;
sel_initfile(&sel, &t->f, fd, SEL_READ, t_read, t);
sel_addfile(&t->f);
- T( trace(T_TUNNEL, "tunnel: attached interface %s to peer `%s'",
+ T( trace(T_TUNNEL, "tun-unet: attached interface %s to peer `%s'",
t_ifname(t), p_name(p)); )
return (t);
}
static void t_inject(tunnel *t, buf *b)
{
IF_TRACING(T_TUNNEL, {
- trace(T_TUNNEL, "tunnel: inject decrypted packet");
- trace_block(T_PACKET, "tunnel: packet contents", BBASE(b), BLEN(b));
+ trace(T_TUNNEL, "tun-unet: inject decrypted packet");
+ trace_block(T_PACKET, "tun-unet: packet contents", BBASE(b), BLEN(b));
})
write(t->f.fd, BBASE(b), BLEN(b));
}