summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2013-11-06owfd: wpa: parse GO_NEG_SUCCESS and GROUP_STARTEDHEADmasterDavid Herrmann3-3/+112
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>
2013-11-06owfd: wpa: make name-arg required for P2P_DEVICE_FOUNDDavid Herrmann1-2/+2
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>
2013-11-06owfd: p2pd: acknowledge p2p-prov-disc-show-pin in dummyDavid Herrmann3-0/+46
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>
2013-11-06owfd: p2pd: add dummy clientDavid Herrmann4-0/+109
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>
2013-11-06owfd: p2pd: add event-fn callbacks to interfaceDavid Herrmann2-0/+75
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>
2013-11-06owfd: p2pd: remove useless semicolonDavid Herrmann1-1/+1
That somehow slipped through. Remove the useless semicolon. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-11-06shl: add dlist helperDavid Herrmann2-0/+139
New double-linked-list helper for basic list operations. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-11-06owfd: p2pd: print wpa events as debug msgDavid Herrmann1-0/+17
Print wpa-events as debug message whenever we get one. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-11-06owfd: wpa: add P2P-FIND-STOPPEDDavid Herrmann3-0/+3
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>
2013-11-06owfd: wpa: add event-name getterDavid Herrmann2-0/+15
Add small helper to retrieve the event-name of a given type. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-11-06owfd: wpa: fix mac-parserDavid Herrmann1-1/+1
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>
2013-11-06owfd: wpa: parse basic p2p/ap eventsDavid Herrmann3-20/+320
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>
2013-11-06owfd: wpa: add wpa-event parser skeletonDavid Herrmann6-5/+338
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>
2013-11-06owfd: move wpa_ctrl.h -> wpa.hDavid Herrmann5-7/+6
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>
2013-11-05owfd: p2pd: ignore inotify_add_watch() failureDavid Herrmann1-5/+7
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>
2013-11-04owfd: dhcp: add basic DHCP serverDavid Herrmann1-0/+73
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>
2013-11-04owfd: dhcp: don't add addr-label for serversDavid Herrmann1-10/+15
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>
2013-11-04shl: add l+og_ERR() handlersDavid Herrmann2-0/+16
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>
2013-11-04owfd: dhcp: convert ipv6 input to ipv4David Herrmann1-7/+65
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>
2013-11-04owfd: dhcp: add --ipv4/ipv6 optionDavid Herrmann2-1/+29
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>
2013-11-04owfd: dhcp: add server skeletonDavid Herrmann1-0/+45
Add server skeleton to create the gdhcp server object. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-11-04owfd: dhcp: implement basic DHCP clientDavid Herrmann1-1/+303
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>
2013-11-04owfd: dhcp: cache if-labelDavid Herrmann1-0/+9
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>
2013-11-04owfd: dhcp: print warning if not running as euid=0David Herrmann1-0/+3
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>
2013-11-04owfd: dhcp: resolve interface name during setupDavid Herrmann1-0/+10
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>
2013-11-04owfd: shared: add if_name_to_index helperDavid Herrmann2-0/+31
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>
2013-11-04owfd: dhcp: add dhcp helpers skeletonDavid Herrmann6-1/+657
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>
2013-10-31Import gdhcp from connmanDavid Herrmann12-3/+6012
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>
2013-10-31owfd: rtsp: add tokenizerDavid Herrmann4-1/+226
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>
2013-10-31owfd: rtsp: ignore binary 0David Herrmann1-1/+8
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>
2013-10-31test: rtsp: test quoted stringsDavid Herrmann1-0/+24
Add some rather complex test to stress the quoted-string parser. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-10-31owfd: rtsp: support quoted stringsDavid Herrmann1-11/+75
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>
2013-10-31test: rtsp: add basic parser testsDavid Herrmann1-4/+191
Stress tests for the rtsp message parser. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-10-31owfd: rtsp: remove trailing whitespace in headersDavid Herrmann1-0/+4
Trailing whitespace are ignored in headers. Remove them. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-10-31owfd: rtsp: fix last-char when sanitizing headersDavid Herrmann1-1/+3
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>
2013-10-31Fix some random uninitialized-var warningsDavid Herrmann4-1/+7
Besides on r = 0; initialization, all of these are false warnings. Stupid gcc.. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-10-31build: add proper autotools build filesDavid Herrmann10-6/+481
Use autotools to generate the openwfd project instead of a statically managed Makefile. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-10-31owfd: rtsp: add rtsp control socket and decoderDavid Herrmann6-1/+1308
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>
2013-10-30wfd: extend spec-headerDavid Herrmann1-0/+347
Add missing IE subelement bits and definitions to the wfd-defs header. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-10-30openwfd_ie: account for OUI in IE lengthDavid Herrmann1-19/+21
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>
2013-10-30openwfd_ie: support multi-IE sub-elementsDavid Herrmann2-73/+199
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>
2013-10-29owfd: p2pd: setup wpa_supplicantDavid Herrmann1-0/+52
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>
2013-10-29owfd: p2pd: save p2pd-config in interfaceDavid Herrmann1-13/+13
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>
2013-10-29owfd: p2pd: rename owfd_p2pd_wpa_event -> wpa_eventDavid Herrmann1-6/+6
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>
2013-10-29owfd: p2pd: remove unused variableDavid Herrmann1-1/+1
"old" is no longer used since we dispatch signals via ppoll() instead of direct sigprocmask. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-10-29owfd: p2pd: add event handlerDavid Herrmann1-3/+26
Handle wpa events and dispatch the wpa-ctrl fd. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2013-10-29owfd: p2pd: catch race in wait_for_wpa()David Herrmann1-36/+21
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>
2013-10-29owfd: p2pd: use ppoll instead of racy sigprocmaskDavid Herrmann1-13/+9
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>
2013-10-29owfd: wpa_ctrl: add signal handlingDavid Herrmann2-16/+34
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>
2013-10-29owfd: wpa_ctrl: use 10s default timeoutDavid Herrmann1-5/+5
Use a 10s timeout instead of 1s (same as official wpa-ctrl). Signed-off-by: David Herrmann <dh.herrmann@gmail.com>