X-Git-Url: https://git.distorted.org.uk/~mdw/secnet/blobdiff_plain/c6f79b178fe27ee315055dccb371b63ca1a6183a..794f2398b8fe84bf398bb10d6eeca6fe6737f65f:/tun.c?ds=inline diff --git a/tun.c b/tun.c index 6f42dd2..20ae29b 100644 --- a/tun.c +++ b/tun.c @@ -64,14 +64,13 @@ static void tun_afterpoll(void *sst, struct pollfd *fds, int nfds, } if (l>0) { st->buff->size=l; - st->netlink_to_tunnel(&st->nl,NULL,st->buff); + st->netlink_to_tunnel(&st->nl,st->buff); BUF_ASSERT_FREE(st->buff); } } } -static void tun_deliver_to_kernel(void *sst, void *cid, - struct buffer_if *buf) +static void tun_deliver_to_kernel(void *sst, struct buffer_if *buf) { struct tun *st=sst; @@ -234,7 +233,7 @@ static list_t *tun_apply(closure_t *self, struct cloc loc, dict_t *context, if (!st->ifconfig_path) st->ifconfig_path="ifconfig"; if (!st->route_path) st->route_path="route"; st->buff=find_cl_if(dict,"buffer",CL_BUFFER,True,"tun-netlink",loc); - st->local_address=string_to_ipaddr( + st->local_address=string_item_to_ipaddr( dict_find_item(dict,"local-address", True, "netlink", loc),"netlink"); add_hook(PHASE_GETRESOURCES,tun_phase_hook,st); @@ -252,9 +251,6 @@ static list_t *tun_old_apply(closure_t *self, struct cloc loc, dict_t *context, st=safe_malloc(sizeof(*st),"tun_old_apply"); - Message(M_WARNING,"the tun-old code has never been tested. Please report " - "success or failure to steve@greenend.org.uk\n"); - /* First parameter must be a dict */ item=list_elem(args,0); if (!item || item->type!=t_dict) @@ -264,7 +260,7 @@ static list_t *tun_old_apply(closure_t *self, struct cloc loc, dict_t *context, st->netlink_to_tunnel= netlink_init(&st->nl,st,loc,dict, - "netlink-tun",NULL,tun_deliver_to_kernel); + "netlink-tun",tun_set_route,tun_deliver_to_kernel); st->tun_old=True; st->device_path=dict_read_string(dict,"device",False,"tun-netlink",loc); @@ -280,7 +276,7 @@ static list_t *tun_old_apply(closure_t *self, struct cloc loc, dict_t *context, if (!st->ifconfig_path) st->ifconfig_path="ifconfig"; if (!st->route_path) st->route_path="route"; st->buff=find_cl_if(dict,"buffer",CL_BUFFER,True,"tun-netlink",loc); - st->local_address=string_to_ipaddr( + st->local_address=string_item_to_ipaddr( dict_find_item(dict,"local-address", True, "netlink", loc),"netlink"); /* Old TUN interface: the network interface name depends on which