9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Venti on OpenBSD - some information and a question
@ 2020-05-04 20:05 Ole-Hjalmar Kristensen
  2020-05-04 20:09 ` [9fans] " ori
  0 siblings, 1 reply; 3+ messages in thread
From: Ole-Hjalmar Kristensen @ 2020-05-04 20:05 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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

I am in the process of moving a venti from Linux to OpenBSD.
First, unless int _p9dir(struct stat *lst, struct stat *st, char *name, Dir
*d, char **str, char *estr) is patched, it will always return size 0 for
raw partitions.
We need to allow character devices as well, not just block devices:

diff --git a/src/lib9/_p9dir.c b/src/lib9/_p9dir.c
index 58c63573..0fb3410e 100644
--- a/src/lib9/_p9dir.c
+++ b/src/lib9/_p9dir.c
@@ -230,7 +230,7 @@ _p9dir(struct stat *lst, struct stat *st, char *name,
Dir *d, char **str, char *
  d->qid.path = ('c'<<16)|st->st_rdev;
  }
  /* fetch real size for disks */
- if(S_ISBLK(lst->st_mode)){
+ if(S_ISBLK(lst->st_mode) || S_ISCHR(lst->st_mode)){
  if((fd = open(name, O_RDONLY)) >= 0){
  d->length = disksize(fd, st);
  close(fd);
dell-openbsd$ git log | head
commit c1c1b5267fd5e14be531a4b22ed0124b35d427cb
Author: sean <phonologus@gmail.com>
Date:   Wed Apr 29 11:21:35 2020 +0100

Second, if your raw partitions are MBR partitions, not OpenBSD disk labels,
you will still get 0 size, so venti will not run.
Disk with only MBR partitions:

dell-openbsd# disklabel sd1
16 partitions:
#                size           offset  fstype [fsize bsize   cpg]
  c:        488378645                0  unused
  i:        460800000              256 unknown
  j:         25600000        460800256 unknown
  k:          1834980        486400770 unknown

In this case you will need to run disklabel and edit the label to get BSD
partitions:
dell-openbsd# disklabel sd1.
16 partitions:
#                size           offset  fstype [fsize bsize   cpg]
  c:        488378645                0  unused
  d:        460800000              256  4.2BSD   4096 32768     1
  e:         25600000        460800256  4.2BSD   4096 32768     1
  f:          1834980        486400770  4.2BSD   4096 32768     1
  i:        460800000              256 unknown
  j:         25600000        460800256 unknown
  k:          1834980        486400770 unknown

Now for the question. For some reason, the venti running on OpenBSD is
refusing connections, both on port 80 and on 17034. No error messages from
venti that I can see.
dell-openbsd# bin/venti/venti -d -c /home/ole/venti/v2.conf
2020/0504 21:48:08 venti: conf...httpd tcp!*!80...init...icache
1,895,825,408 bytes = 18,850,537 entries; 16 scache
sync...announce tcp!*!17034...serving.

I can connect to the venti from localhost, but not from any other machine.
However, if I run nc -l on ports 17034 and 80, I can connect from any
machine. It is definitely not the packet filter, since the problem persists
even if I disable the packet filter. Any suggestions about what might be
blocking the connection?

The only real clue I have is that even on localhost I get "connection
refused", but telnet switches to IPv6 and that attempt is accepted:
dell-openbsd$ telnet localhost 17034
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
Trying ::1...
Connected to localhost.
Escape character is '^]'.
venti-04:02-libventi

Is it possible that venti somehow is listening only on the IPv6 address?

Ole-Hj.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] Venti on OpenBSD - some information and a question
  2020-05-04 20:05 Venti on OpenBSD - some information and a question Ole-Hjalmar Kristensen
@ 2020-05-04 20:09 ` ori
  2020-05-04 20:58   ` Ole-Hjalmar Kristensen
  0 siblings, 1 reply; 3+ messages in thread
From: ori @ 2020-05-04 20:09 UTC (permalink / raw)
  To: ole.hjalmar.kristensen, 9fans

> I can connect to the venti from localhost, but not from any other machine.
> However, if I run nc -l on ports 17034 and 80, I can connect from any
> machine. It is definitely not the packet filter, since the problem persists
> even if I disable the packet filter. Any suggestions about what might be
> blocking the connection?

My first guess is that it's listening on the wrong interface.
Run it under 'ktrace', then run 'kdump' and look for the bind()
calls and friends.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] Venti on OpenBSD - some information and a question
  2020-05-04 20:09 ` [9fans] " ori
@ 2020-05-04 20:58   ` Ole-Hjalmar Kristensen
  0 siblings, 0 replies; 3+ messages in thread
From: Ole-Hjalmar Kristensen @ 2020-05-04 20:58 UTC (permalink / raw)
  To: ori; +Cc: Fans of the OS Plan 9 from Bell Labs

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

Thanks, I found the problem by inspection of src/lib9/_p9dialparse.c.
IPv6 is indeed the default when using an address of tcp!*!17034
 /* translate host */
if(strcmp(host, "*") == 0){
ss->ss_family = AF_INET6;
((struct sockaddr_in6*)ss)->sin6_addr = in6addr_any;
}else if((he = gethostbyname(host)) != nil && he->h_addr_list[0] != nil){

So, setting the address string to tcp!dell-openbsd!17034 fixed the problem.
My Linux machines actually have an IPv6 address, the OpenBSD box does not,
so that explains the difference.

Ole-Hj.

On Mon, May 4, 2020 at 10:09 PM <ori@eigenstate.org> wrote:

> > I can connect to the venti from localhost, but not from any other
> machine.
> > However, if I run nc -l on ports 17034 and 80, I can connect from any
> > machine. It is definitely not the packet filter, since the problem
> persists
> > even if I disable the packet filter. Any suggestions about what might be
> > blocking the connection?
>
> My first guess is that it's listening on the wrong interface.
> Run it under 'ktrace', then run 'kdump' and look for the bind()
> calls and friends.
>
>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-04 20:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-04 20:05 Venti on OpenBSD - some information and a question Ole-Hjalmar Kristensen
2020-05-04 20:09 ` [9fans] " ori
2020-05-04 20:58   ` Ole-Hjalmar Kristensen

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).