From: Wonsup Yoon <pus...@kaist.ac.kr> Committer: Waldemar Kozaczuk <jwkozac...@gmail.com> Branch: master
run.py: add tap option Currently, OSv needs root permission for tap networking. However, if we have a tap interface with proper permission, we can do tap networking without root permission. This adds --tap option to specify tap interface. It enables tap networking without root permission. Usage: On root: adduser user1 kvm # allow user 1 to use kvm tunctl -u user1 -t user1_tap0 # add tap interface for user1 On user1 (without root/sudo): ./scripts/run.py -n --tap user1_tap0 Signed-off-by: Wonsup Yoon <pus...@kaist.ac.kr> Message-Id: <20200413140011.10747-1-pus...@kaist.ac.kr> --- diff --git a/scripts/run.py b/scripts/run.py --- a/scripts/run.py +++ b/scripts/run.py @@ -190,7 +190,9 @@ def start_osv_qemu(options): net_device_options.append('mac=%s' % options.mac) if options.networking: - if options.vhost: + if options.tap: + args += ["-netdev", "tap,id=hn%d,ifname=%s,script=no,downscript=no" % (idx, options.tap)] + elif options.vhost: args += ["-netdev", "tap,id=hn%d,script=%s,vhost=on" % (idx, os.path.join(osv_base, "scripts/qemu-ifup.sh"))] else: for bridge_helper_dir in ['/usr/libexec', '/usr/lib/qemu']: @@ -489,6 +491,8 @@ def main(options): help="bridge name for tap networking") parser.add_argument("-v", "--vhost", action="store_true", help="needs root. tap networking and vhost") + parser.add_argument("-t", "--tap", action="store", + help="tap interface name") parser.add_argument("-m", "--memsize", action="store", default="2G", help="specify memory: ex. 1G, 2G, ...") parser.add_argument("-c", "--vcpus", action="store", default="4", -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/00000000000051486405a359fc18%40google.com.