Move tun functions to a new tun.c.

(cherry picked from commit ff6f7fe4bd983c623d490100fa17cdb4936b95a2)

Change-Id: I1effc2309565375bbe98262dd602a0895ab49fcf
5 files changed