Age | Commit message (Collapse) | Author | Files | Lines |
|
Both events are needed for proper P2P group setup handling. Parse their
parameters so we can deal with them correctly.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
We currently allow name==NULL, which might cause breakage for some
clients. Always require the name argument or return EINVAL.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
As a workaround for the dummy client, acknowledge all P2P provision
discovery requests to show PINs with the related connect command.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
The dummy client is used to interact with the p2pd-interface
infrastructure as long as we have no external programs. The dummy will be
used for basic testing and development. It will get trashed once we have a
real interface (or another network-manager finally picks up p2p).
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Allow external programs to register event-functions. We call these for all
wpa events we get. This way, we can later add external dbus APIs or
similar to allow clients to visualize our p2p events and add user
interfaces.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
That somehow slipped through. Remove the useless semicolon.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
New double-linked-list helper for basic list operations.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Print wpa-events as debug message whenever we get one.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
This event is sent whenever the p2p-find procedure is stopped. We need to
catch it in case other clients cause it to stop (or it's stopped
implicitly through a connection procedure, etc).
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Add small helper to retrieve the event-name of a given type.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
We actually need to parse hex numbers, not decimal numbers. Fix the mac
parser to account for that.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Add parsers for the most basic payloads that we need during the beginning.
Further payload parsers can be added once we have a use-case for them.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
wpa_supplicants sends events formatted as strings. This makes it
human-readable, but rather annoying to parse and compare. Thus, we add a
small parser to turn wpa-events into some binary format for easy
comparison and handling.
We don't support all events but only the events we need. Feel free to add
new events once you need them. Also note that we don't parse parameters,
yet. This will also be added on a per-need basis.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
We are going to add some more wpa helpers. Rename the header to better
resemble what it defines. The wpa_ctrl interface will be only one of many.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
If the parent directory does not exist, yet, we cannot watch it. We would
have to watch the parent of it until the directory itself is created
(maybe multiple layers). Avoid this complexity by just polling with
reasonable timeouts instead.
Same for the file itself which might already exist (due to unclean
shutdown) and might get recreated.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
This now fully implements the gdhcp based dhcp server functions. Nothing
special, just forwarding the options.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
gdhcp seems to be unable to cope with labeled addresses. Don't use them
for servers.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
New l+og_ERR() handlers automatically set errno and then forward the error
code so we can make use of %m.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
gdhcp uses inet_aton() and thus cannot deal with embedded IPv4. Add a
small parser to convert addresses if IPv4 is selected. Otherwise, the
gdhcp server will fail to read them.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
These options are mandatory and select which DHCP flavor to run. Note that
ipv6 servers are not provided by gdhcp.
All our arguments are IPv6 only! If you pass IPv4 addresses, you must
embed them in ipv6 addresses as usual. This will avoid any IPv4 special
handling in the caller (though internally we still need to distinguish
them).
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Add server skeleton to create the gdhcp server object.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Implement the --client option and spawn gdhcp_client accordingly. Once we
get a lease, set the information via "ip" for the given network interface.
Note that we don't support any routing/gateways, DNS or other stuff. This
is not needed for WFD so it's unlikely to get implemented. Ever.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
We use "ip" to configure linux net interfaces. This avoids heavy netlink
operations in this small helper. To avoid cluttering the IP namespace, we
pass special labels to "ip". We cache this label so we don't have to
allocate it all the time.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
DHCP and interface-setup requires CAP_NET_ADMIN. As we don't want to deal
with libcap and capability-setup, we simply let the caller take care of
it.
To avoid mis-use, we print a warning for euid!=0, in case users run it
from the command-line (debugging, etc).
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Resolve the interface name and retrieve the ifindex during setup. We can
now print useful error-messages early if the name is invalid.
The index is cached so we don't have to call it twice.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
gdhcp requires an interface index instead of an interface name. This
helpers returns the index of an interface or an error if the interface
cannot be found.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
All known dhcp daemons have horrible interfaces if you want to use them
for short-lived ad-hoc networks like Wifi-P2P. Therefore, we use our own
helper with gdhcp as DHCP implementation.
openwfd_dhcp implements a DHCP server and daemon. Depending in the given
command-line argument, it is run as either. All configuration parameters
are passed via command-line.
Note that openwfd_dhcp is a workaround and should only be used as such.
Once network-managers pick up proper Wifi-P2P APIs, we can remove
openwfd_p2pd (including openwfd_dhcp) and start using their APIs. Until
then, we need this small hack.
This patch only adds the dhcp skeleton. No real functionality is added,
yet.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Wifi-P2P needs dhcp to exchange addresses. As there is no decent dhcp
daemon out there, which can be controlled from an application ad-hoc, we
import gdhcp from connman.
gdhcp is a client and server implementation of dhcp controllable via a
simple API. We can use it to implement any kind of dhcp client and daemon
we want.
Unfortunately, gdhcp is GPLv2. That means all linking binaries are also
GPLv2. We don't care, but we need to explicitly mention it so others will
notice.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
The tokenizer does what the name says: Split a line into tokens. This will
be useful for more advanced header-lines where we need to split them up so
we can parse them.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Ignore binary 0 under all circumstances. It's just braindead to use it in
ASCII protocols. Turn escape sequences into "\0" so a tokenizer won't have
to deal with it.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Add some rather complex test to stress the quoted-string parser.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Our rtsp parser must support quoted strings in header-lines. We don't
tokenize, yet, so no need to transform them, yet.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Stress tests for the rtsp message parser.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Trailing whitespace are ignored in headers. Remove them.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
If we replace characters, we need to also set the last_c char. Otherwise,
the "prev" char will not reflect the change.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Besides on r = 0; initialization, all of these are false warnings.
Stupid gcc..
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Use autotools to generate the openwfd project instead of a statically
managed Makefile.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
The rtsp control socket provides basic I/O functions for RTSP streams. The
decoder allows turning raw streams into RTSP messages.
Note that both can be used for servers *and* clients. In particular, in
RTSP the wire-protocol is the same for both.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Add missing IE subelement bits and definitions to the wfd-defs header.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
The OUI field is accounted for in IE length (thus allowing full 255 size).
Account for that in the parser.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Sub-elements can span over multiple IEs. We simply concatenate the
payloads and treat them as single uniform payload of a single IE. The IE
headers must match for each concatenated IE, though.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Set basic parameters so we can perform p2p and wifi-display operations.
Fail is the stack doesn't support either.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Save pointer to p2pd config so we can use it in other parts than setup.
Also simplifies parameter passing slightly.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Avoid the global owfd_p2pd_* prefix as this is a sub-module inside of
owfd_p2pd_interface_*. As this prefix is too long, just use wpa_event.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
"old" is no longer used since we dispatch signals via ppoll() instead of
direct sigprocmask.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Handle wpa events and dispatch the wpa-ctrl fd.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
If wpa_supplicant already opened the socket but is not ready to receive
events, yet, we need to continue trying. This is ugly, but stupid
SOCK_DGRAM leaves us no choice.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Instead of using sigprocmask as racy way to unblock signals, we now use
ppoll() so we reliably catch signals during blocking waits.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Allow callers to provide a sigmask that is passed to ppoll() and watched
for during _all_ blocking calls. Allows callers to reliably catch signals
during requests.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
|
Use a 10s timeout instead of 1s (same as official wpa-ctrl).
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|