SYN_RCVD

2016-06-03 Thread Peter J. Philipp
Hi,

In Mac OS X when I spoof a packet to it it prints somethign like this in
the netstat -na:

-
Active Internet connections (including servers)
Proto Recv-Q Send-Q  Local Address  Foreign Address   
(state)   
tcp4   0  0  192.168.180.64.22  20.20.20.20.29991 
SYN_RCVD  
tcp4   0  0  192.168.180.64.22  20.20.20.20.2 
SYN_RCVD  
-

When I do the same to an OpenBSD host between 5.5 and 6.0 (I couldn't
look further back due to newish hardware sorry), I noticed that no such
state is written.

However pfctl -ss picks it up but netstat is silent.  Let me give you an
example:


# pfctl -ss | grep 20.20.20 && netstat -na|grep 20.20.20
all tcp 192.168.34.4:22 <- 20.20.20.20:1   SYN_SENT:ESTABLISHED


I'm unaware of this ever working on OpenBSD but it could be that it once
did.  Absolute OpenBSD by Michael W. Lucas (second edition) on page 201
mentions the SYN_RCVD state, so he must have seen it at one point.

Also the state diagram of RFC 793 page 23, shows more on this matter. 

So my question really is:  Why was this functionality removed from
OpenBSD at some point?  When did that happen?  And why did it happen?  I
saw mention of SYN_RCVD in 1 comment of the netinet/tcp_input.c file,
but that was a long time ago and dealt with IPv6.

Regards,

-peter



Re: wifind(8) find your wifi

2016-06-03 Thread Stefan Sperling
On Sat, Jun 04, 2016 at 02:38:06AM +0800, Ray Lai wrote:
> On Fri, 3 Jun 2016 15:52:34 +0200
> Stefan Sperling  wrote:
> > One thing we should probably fix first is roaming support in the kernel.
> 
> Do you mean 802.11r support?

No, that extension seems to be about moving fast across a huge range.
It addresses a special case of roaming.

AFAIK the standard doesn't specify how roaming should be done in general.

I mean just something like watching for beacon signal strength, counting
missed beacons, or whatever heuristic is possible with the given hardware,
and then retriggering a scan when the AP can be considered "gone" or a
"better" AP is available.
And get this working with as many drivers as possible.



Re: wifind(8) find your wifi

2016-06-03 Thread Ray Lai
> On Jun 3, 2016, at 8:42 PM, Erling Westenvik 
wrote:
> As much as I endorse and approve of any effort to create a good solution
> for handling wifi's, I must say I find the use of perl and json
> unnecessary for such a project. I've been using a "pure ksh" solution
> named wiconfig since 2013 and which was posted here at @misc back in
> 2011 or 2012:

I've checked out wiconfig prior to wifind, but I couldn't figure out how to
use it, and couldn't figure it out from the 500-line shell script.

This script, for now, merely parses a config file and ifconfig scan output and
writes a new hostname.if. I understand it.

>
http://openbsd-archive.7691.n7.nabble.com/wiconfig-simplifies-the-configurati
on-of-wireless-interfaces-td89829.html
>
> It is available on github:
>
> https://github.com/devious/wiconfig/blob/master/wiconfig
>
> wiconfig:
> - Works great with apm/resume, including trunk(4) interfaces.
> - Has no dependencies. Just pure old fashioned ksh.

This is a nice benefit, as it can be run even when upgrading, theoretically.

> - Stores (accepted) connections in plain text format. (/etc/wiconfig.db)

I couldn't figure this out from the documentation and code, unfortunately.

> - Handles quoted nwids.

Does it handle nwids with quotes within, eg "network "name""?

> - Does not require writing to /etc/hostname.if-files.

The reason I chose to write hostname.if files is upgrades. I don't expect this
program to be functional during upgrades, nor any other non-base solution. So
the simplest solution was to save the latest best-known network configuration
so that the network would have a decent chance of being usable during
upgrades.

Cheers,
Ray



Re: wifind(8) find your wifi

2016-06-03 Thread Ray Lai
On Fri, 3 Jun 2016 10:33:47 +0100
skin...@britvault.co.uk (Craig Skinner) wrote:

> Hi Ray,
> 
> On 2016-06-03 Fri 00:26 AM |, Ray Lai wrote:
> > 
> > I got tired of configuring my wifi every time I had to move my laptop.
> > Here's a script a whipped up.  
> 
> port it up: http://www.OpenBSD.Org/faq/ports/guide.html
> 
> Cheers!

Done: http://permalink.gmane.org/gmane.os.openbsd.ports/80223



Re: wifind(8) find your wifi

2016-06-03 Thread Ray Lai
On Fri, 3 Jun 2016 15:52:34 +0200
Stefan Sperling  wrote:

> On Fri, Jun 03, 2016 at 03:22:19PM +0200, Kamil Cholewiński wrote:
> > Perhaps it's time that the best tool be chosen and made a part of the
> > base install? I've already seen like a 100 different OBSD WiFi scripts
> > floating around the 'net, and naturally I also have a DIY one.
>
> No scripts for this, please.
>
> We need a well engineered to make the kernel handle this, perhaps with some
> help from userland. Various ideas have been porposed (not always on list,
> but mostly during face-to-face discussions at hackathons).
>
> What we need is someone who wants to sit down and drive the project home,
> i.e. wrap up the design discussion within the community and write the code.
> I'm up for helping people through this, but it really needs someone else
> dedicated to take responsibility for this project and the implementation.
>
> One thing we should probably fix first is roaming support in the kernel.

Do you mean 802.11r support?



Re: wifind(8) find your wifi

2016-06-03 Thread Ray Lai
> On Jun 3, 2016, at 8:59 PM, Etienne  wrote:
> On 06/03/16 05:12, Ray Lai wrote:
>>>
>>> #!/bin/sh
>>>
>>> if [[ $1 == "home" ]]; then
>>>doas ifconfig run0 nwid foonet wpa wpakey ultrasecret
>>>doas dhclient run0
>>> fi
>> Yup. The goal of wifind is to do exactly this, the moment I resume my
laptop,
>> without my interaction.
> May I know what's triggering it? I have something similar, but I need to
click on a button to run it.

/etc/apm/resume

Check apmd(8)



Re: wifind(8) find your wifi

2016-06-03 Thread Etienne

On 06/03/16 14:31, Raf Czlonka wrote:



May I know what's triggering it? I have something similar, but I need to
click on a button to run it.

/etc/apm/resume I presume :^)

man 8 apmd


Thanks.



Re: wifind(8) find your wifi

2016-06-03 Thread Stefan Sperling
On Fri, Jun 03, 2016 at 03:22:19PM +0200, Kamil Cholewiński wrote:
> Perhaps it's time that the best tool be chosen and made a part of the
> base install? I've already seen like a 100 different OBSD WiFi scripts
> floating around the 'net, and naturally I also have a DIY one.

No scripts for this, please.

We need a well engineered to make the kernel handle this, perhaps with some
help from userland. Various ideas have been porposed (not always on list,
but mostly during face-to-face discussions at hackathons).

What we need is someone who wants to sit down and drive the project home,
i.e. wrap up the design discussion within the community and write the code.
I'm up for helping people through this, but it really needs someone else
dedicated to take responsibility for this project and the implementation.

One thing we should probably fix first is roaming support in the kernel.



Re: wifind(8) find your wifi

2016-06-03 Thread Raf Czlonka
On Fri, Jun 03, 2016 at 01:59:08PM BST, Etienne wrote:
> On 06/03/16 05:12, Ray Lai wrote:
> > > 
> > > #!/bin/sh
> > > 
> > > if [[ $1 == "home" ]]; then
> > > doas ifconfig run0 nwid foonet wpa wpakey ultrasecret
> > > doas dhclient run0
> > > fi
> > Yup. The goal of wifind is to do exactly this, the moment I resume my 
> > laptop,
> > without my interaction.
> > 
> May I know what's triggering it? I have something similar, but I need to
> click on a button to run it.

/etc/apm/resume I presume :^)

man 8 apmd

Regards,

Raf



Re: wifind(8) find your wifi

2016-06-03 Thread Kamil Cholewiński
Perhaps it's time that the best tool be chosen and made a part of the
base install? I've already seen like a 100 different OBSD WiFi scripts
floating around the 'net, and naturally I also have a DIY one.



Re: wifind(8) find your wifi

2016-06-03 Thread Etienne

On 06/03/16 05:12, Ray Lai wrote:


#!/bin/sh

if [[ $1 == "home" ]]; then
doas ifconfig run0 nwid foonet wpa wpakey ultrasecret
doas dhclient run0
fi

Yup. The goal of wifind is to do exactly this, the moment I resume my laptop,
without my interaction.

May I know what's triggering it? I have something similar, but I need to 
click on a button to run it.


Cheers,

--
Étienne



Re: wifind(8) find your wifi

2016-06-03 Thread Erling Westenvik
As much as I endorse and approve of any effort to create a good solution
for handling wifi's, I must say I find the use of perl and json
unnecessary for such a project. I've been using a "pure ksh" solution
named wiconfig since 2013 and which was posted here at @misc back in
2011 or 2012:

http://openbsd-archive.7691.n7.nabble.com/wiconfig-simplifies-the-configuration-of-wireless-interfaces-td89829.html

It is available on github:

https://github.com/devious/wiconfig/blob/master/wiconfig

wiconfig:
- Works great with apm/resume, including trunk(4) interfaces.
- Has no dependencies. Just pure old fashioned ksh.
- Stores (accepted) connections in plain text format. (/etc/wiconfig.db)
- Handles quoted nwids.
- Does not require writing to /etc/hostname.if-files.

Not sure how/if it handles potentially unsafe nwid names, though.

Regards.

-- 
Erling Westenvik
,_,
|_|_|_|
|_|X|_|
|_|_|_|

On Fri, Jun 03, 2016 at 11:58:05AM +0800, Ray Lai wrote:
> > On Jun 3, 2016, at 2:36 AM, Kamil Cholewiński  wrote:
> >> On Thu, 02 Jun 2016, Ray Lai  wrote:
> >> use JSON::PP;
> >
> > That's just my personal opinion, but JSON sucks for configuration files.
> > It's more of a human-readable data interchange format.
> >
> > It feels like the same functionality can be achieved with something much
> > simpler, getent or CSV style.
> 
> I agree. All I need are hashes and arrays. Any examples would be welcome, I'm
> open to changing the file format. But as wifind.conf(5) says, I chose json
> because it's included in Perl. I was more concerned with having a
> set-it-and-forget-it solution. The config file is a minor detail that can be
> changed.
> >
> >> my $tmp = "/etc/wifind.tmp";
> >
> > mkstemp?
> 
> Will fix
> 
> >> Please avoid nwid or wpakey with quotes, dollar signs, or backslashes.
> >
> > Without knowing or assuming much about how WiFi works, why would this be
> > a concern in a well-designed program?
> 
> Currently wifind parses 'ifconfig if scan' output, which, according to my
> reading of the code, simply adds "double quotes" around any nwid with white
> space when printing. (I've not tested my theory that nwid with " in the name
> would cause problem. )
> 
> Likewise, netstart takes nwid and wpakey, which could include spaces, but as
> netstart is a shell script, I have not tested what happens when the values
> contain backslashes, dollar signs, or double quotes. Caveat emptor!
> 
> 
> Thanks for your feedback, I appreciate it!
> 
> Ray



Re: Joining bridge(4) changes broadcast?

2016-06-03 Thread Masao Uebayashi
Moving bpf_mtap_ether() from if_input() to (the top of) ether_input() makes
PPPoE session successfully get established.

On Thu, Jun 02, 2016 at 02:25:39PM +0900, Masao Uebayashi wrote:
> I spoke too early; I thought frames were broken but actually it was not.
> What was happening, according to tcpdump(8), was that frames, both broadcast
> and unicast, are flooded for some reason, and pppoe(4) fails to receive
> necessary frames in order.
> 
> OTOH, assigning IP addresses and pinging between pair(4)'s doesn't flood
> frames.
> 
> bridge(4) and bpf(4) interacting badly?
> 
> On Thu, Jun 02, 2016 at 10:34:10AM +0900, Masao Uebayashi wrote:
> > I'm playing with PPPoE and it (npppd(8) + oe(4)) works fine with patched
> > pair(4) interfaces, that's good.
> > 
> >patch
> >   pair0 --- pair1
> >   pppoe npppd
> > 
> > To try more wierd things, I added one pair(4), to which npppd(8) was 
> > listening
> > on, to a bridge(4).  This stops pppoe(4) from working.  Seems PPPoE 
> > Discovery
> > frames sent to pppoe(4) get broken.
> > 
> >patch bridge0
> >   pair0 --- pair1 =
> >   pppoe npppd
> > 
> > If I add another interface, e.g. vether(4), to the bridge and let npppd(8)
> > listen on vether(4), things work.
> > 
> >patch bridge0
> >   pair0 --- pair1 = vether0
> >   pppoe npppd
> > 
> > I thought adding an interface (pair1) to a bridge does not change what pair1
> > sees logically, or am I wrong?
> > 
> > Masao



Re: wifind(8) find your wifi

2016-06-03 Thread Craig Skinner
Hi Ray,

On 2016-06-03 Fri 00:26 AM |, Ray Lai wrote:
> 
> I got tired of configuring my wifi every time I had to move my laptop.
> Here's a script a whipped up.

port it up: http://www.OpenBSD.Org/faq/ports/guide.html

Cheers!
-- 
I know not with what weapons World War III will be fought,
but World War IV will be fought with sticks and stones.
-- Albert Einstein