copied from tinc_wrapper