2 |
- |
1 |
|
|
|
2 |
This package implements Plan 9's IL and 9fs client for FreeBSD 3.2.
|
|
|
3 |
|
|
|
4 |
> Getting the software
|
|
|
5 |
|
|
|
6 |
9pfreebsd.tgz
|
|
|
7 |
|
|
|
8 |
> Installation
|
|
|
9 |
|
|
|
10 |
0. unpack:
|
|
|
11 |
mkdir ~/9pfreebsd
|
|
|
12 |
cd ~/9pfreebsd
|
|
|
13 |
zcat 9pfreebsd.tgz | tar -xf -
|
|
|
14 |
|
|
|
15 |
this creates the file freebsd-3.2.il-kernel.patch and the
|
|
|
16 |
directory mount_9fs.
|
|
|
17 |
|
|
|
18 |
1. get a fresh copy of the kernel. for example:
|
|
|
19 |
cp -r /usr/src/sys ~/9pfreebsd/freebsd-3.2
|
|
|
20 |
|
|
|
21 |
2. apply the patch:
|
|
|
22 |
cd ~/9pfreebsd/freebsd-3.2
|
|
|
23 |
patch -p0 < ../freebsd-3.2.il-kernel.patch
|
|
|
24 |
|
|
|
25 |
3. build a new kernel:
|
|
|
26 |
cd ~/9pfreebsd/freebsd-3.2/i386/conf
|
|
|
27 |
config IL
|
|
|
28 |
cd ../../compile/IL; make depend; make
|
|
|
29 |
|
|
|
30 |
4. boot the new kernel:
|
|
|
31 |
cp -p /kernel /kernel.good
|
|
|
32 |
cp ~/9pfreebsd/freebsd-3.2/compile/IL/kernel /kernel
|
|
|
33 |
reboot
|
|
|
34 |
|
|
|
35 |
5. build mount_9fs:
|
|
|
36 |
cd ~/9pfreebsd; make
|
|
|
37 |
|
|
|
38 |
> Using IL
|
|
|
39 |
|
|
|
40 |
1. connect via IL:
|
|
|
41 |
|
|
|
42 |
if( (s = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_IL)) < 0 ) {
|
|
|
43 |
perror("socket");
|
|
|
44 |
exit(1);
|
|
|
45 |
}
|
|
|
46 |
|
|
|
47 |
bzero(&sin, sizeof(sin));
|
|
|
48 |
sin.sin_family = AF_INET;
|
|
|
49 |
sin.sin_addr.s_addr = dest_addr;
|
|
|
50 |
sin.sin_port = htons(dest_port);
|
|
|
51 |
if( connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0 ) {
|
|
|
52 |
perror("connect");
|
|
|
53 |
exit(1);
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
2. listen via IL:
|
|
|
57 |
|
|
|
58 |
if( (s = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_IL)) < 0 ) {
|
|
|
59 |
perror("socket");
|
|
|
60 |
exit(1);
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
bzero(&sin, sizeof(sin));
|
|
|
64 |
sin.sin_family = AF_INET;
|
|
|
65 |
sin.sin_addr.s_addr = INADDR_ANY;
|
|
|
66 |
sin.sin_port = htons(port_number);
|
|
|
67 |
|
|
|
68 |
if( bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0 ) {
|
|
|
69 |
perror("bind");
|
|
|
70 |
exit(1);
|
|
|
71 |
}
|
|
|
72 |
|
|
|
73 |
if( listen(s, 5) < 0 ) {
|
|
|
74 |
perror("listen");
|
|
|
75 |
exit(1);
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
len = sizeof(sin);
|
|
|
79 |
if ( (c = accept(s, (struct sockaddr *)& sin, &len)) < 0 ) {
|
|
|
80 |
perror("accept");
|
|
|
81 |
exit(1);
|
|
|
82 |
}
|
|
|
83 |
|
|
|
84 |
|
|
|
85 |
> Using 9fs
|
|
|
86 |
|
|
|
87 |
1. limitations:
|
|
|
88 |
|
|
|
89 |
The current implementation is mostly tested with a single user on
|
|
|
90 |
the client. No one else can access the mounted file system except
|
|
|
91 |
the authenticator. But two users can mount the same file system
|
|
|
92 |
on the client with different nodes. This is not yet tested much.
|
|
|
93 |
|
|
|
94 |
2. mapping plan9 usernames to UNIX uids
|
|
|
95 |
|
|
|
96 |
Mount_9fs requires a translation between plan9 usernames and UNIX
|
|
|
97 |
uids. /etc/9uid.conf contains the map. The format is:
|
|
|
98 |
|
|
|
99 |
plan9_username unix_uid
|
|
|
100 |
|
|
|
101 |
Not all plan9 users have to have an UNIX account on the
|
|
|
102 |
client. Just give them a unique uid which can be non-existent in
|
|
|
103 |
/etc/passwd.
|
|
|
104 |
|
|
|
105 |
3. mounting 9fs:
|
|
|
106 |
|
|
|
107 |
To mount by a regular user, the root has to set vfs.usermount to 1
|
|
|
108 |
first (sysctl -w vfs.usermount=1). Then follow the steps below.
|
|
|
109 |
|
|
|
110 |
To mount by root:
|
|
|
111 |
|
|
|
112 |
mount_9fs -u 9user@9auth_server 9fileserver:path node
|
|
|
113 |
|
|
|
114 |
This mounts "path" on 9fileserver on local "node" on behalf of
|
|
|
115 |
"9user". Plan9 authentication server "9auth_server" is
|
|
|
116 |
contacted to obtain a ticket.
|
|
|
117 |
|
|
|
118 |
mount_9fs will prompt for "9username"'s plan9 password.
|
|
|
119 |
|
|
|
120 |
umount works as usual.
|
|
|
121 |
|
|
|
122 |
Only the caller of mount_9fs has access to the mounted file system.
|
|
|
123 |
|
|
|
124 |
4. WARNING:
|
|
|
125 |
|
|
|
126 |
The password is stored in kernel memory and can be read via kmem.
|
|
|
127 |
|
|
|
128 |
> Bugs and Fixes:
|
|
|
129 |
|
|
|
130 |
You are welcome to contact dong@research.bell-labs.com for bug
|
|
|
131 |
reports and fixes.
|
|
|
132 |
|
|
|
133 |
|
|
|
134 |
|