9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: remywang@cs.washington.edu
To: 9fans <9fans@9fans.net>
Subject: Re: [9fans] Raw ethernet on 9vx
Date: Wed, 9 Dec 2020 02:00:35 -0500	[thread overview]
Message-ID: <16074972350.fF34.73931@composer.9fans.topicbox.com> (raw)
In-Reply-To: <16074740400.63F6dbAdf.71435@composer.9fans.topicbox.com>

[-- Attachment #1: Type: text/plain, Size: 1897 bytes --]

OK, here's what I've got: 

diff --git a/bin/tap b/bin/tap
index 5131834..fbfe066 100755
--- a/bin/tap
+++ b/bin/tap
@@ -8,26 +8,26 @@ cmd=$1
 shift || fatal $usage
 user=`whoami`

-# Create the tap device with tunctl
-iface=`sudo tunctl -b -u $user`
+# Create the tap device with tuntap
+`sudo ip tuntap add tap5 mode tap user $user`
 # or openvpn
 #iface=tap0
 #sudo openvpn --mktun --dev $iface --user $user

 # Bring the tap device up
-sudo /sbin/ifconfig $iface 0.0.0.0 up
+sudo ip link set tap5 up

 # Add it to the bridge
-sudo /usr/sbin/brctl addif br0 $iface
+sudo ip link set tap5 master br0

 # Launch 9vx (use -F to not fork)
-$cmd "$@" -F "ether0=type=tap dev=$iface"
+$cmd "$@" -F "ether0=type=tap dev=tap5"

 # Bring the tap device down and disconnect from br0
-sudo /sbin/ifconfig $iface down
-sudo /usr/sbin/brctl delif br0 $iface
+sudo ip link set tap5 down
+sudo ip link set tap5 nomaster

-# Remove the tap device with tunctl
-sudo tunctl -d $iface &> /dev/null
+# Remove the tap device with tuntap
+sudo ip tuntap del tap5 &> /dev/null
 # or openvpn
 #sudo openvpn --rmtun --dev $1

Running `tap 9vx -r 9front -u glenda`, then `ip/ipconfig` hangs for a while, then it returns "DHCP failed". And on vanilla plan9 it just hangs. FWIW, I got the same result using the old commands from net-tools. 

And several details: 
1. I had to hard-code the tap device name "tap5" because `ip tuntap ...` doesn't return the interface name. 
2. I have no idea what 0.0.0.0 is, or where to pass it in. (tried `ip link set tap5 up address 0.0.0.0` but it complained the address was too short). 

Remy
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T84b4492f91f2abb6-M091abcc56de424937ea9b136
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 9981 bytes --]

  reply	other threads:[~2020-12-09  7:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-07  6:26 remywang
2020-12-07 23:38 ` Devon H. O'Dell
2020-12-08  5:55   ` remywang
2020-12-08  7:12     ` Devon H. O'Dell
2020-12-08  7:45       ` Lucio De Re
2020-12-08  9:06   ` Devon H. O'Dell
2020-12-08  9:20     ` David du Colombier
2020-12-08 13:00       ` hiro
2020-12-09  0:34         ` remywang
2020-12-09  7:00           ` remywang [this message]
2020-12-09 12:46             ` Stuart Morrow
2020-12-09 14:35             ` Lucio De Re
2020-12-09 15:29               ` remywang
2020-12-09 19:03                 ` Lucio De Re

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16074972350.fF34.73931@composer.9fans.topicbox.com \
    --to=remywang@cs.washington.edu \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).