summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2013-04-08dnsproxy: Fix cached message length correctlyJukka Rissanen1-1/+5
We must copy the response buffer before fixing the packet length. Otherwise the packet length will go wrong if the request contained EDNS0 data.
2013-04-05dnsproxy: Handle partial TCP messages from clientJukka Rissanen1-65/+410
We were not handling client sent partial TCP messages correctly. This meant that ConnMan would block if the client using TCP would not send full DNS request. When a new TCP client connects in tcp_listener_event(), a new TCP channel is created to handle a partial client message if all of the message is not already available. The partial TCP message is patched together in tcp_client_event(). When all of the TCP message has been received, the message is processed in read_tcp_data(). The client has to send the DNS request within two seconds before the connection is closed by ConnMan.
2013-04-05service: Drop unused argument in preferred_tech_list_get()Daniel Wagner1-2/+2
2013-04-05dnsproxy: Create cache if it is missing when doing lookupJukka Rissanen1-42/+56
2013-04-05dnsproxy: Fix memory leak when request timeoutsJukka Rissanen1-13/+13
2013-04-05dnsproxy: Avoid null pointer accessJukka Rissanen1-2/+2
2013-04-05dnsproxy: Do not add or remove ::1 serverJukka Rissanen1-0/+6
2013-04-05dnsproxy: Use ::1 when refreshing because of the address familyJukka Rissanen1-1/+1
2013-04-05dnsproxy: Add or remove ::1 to/from resolv.conf when necessaryJukka Rissanen1-9/+35
We add IPv6 loopback address to resolv.conf if we have created an IPv6 listening socket to port 53. Also remove ::1 from resolv.conf when deleting the proxy.
2013-04-05dnsproxy: Listen only on needed addressesJukka Rissanen1-91/+225
Do not bind to ANY address so that other DNS server applications can be used on the same host for interfaces that are not managed by ConnMan. This means that we only create DNS listeners on loopback and tethering interfaces.
2013-04-05inet: Get an address from a given interface and address familyJukka Rissanen2-0/+56
The returned address is used when we need to have a listening socket tied to specific interface and address, and do not want to bind to any address.
2013-03-27provider: Set nameservers if we receive them from vpndJukka Rissanen1-10/+4
If we receive nameservers from vpnd we must set them in provider. The connman_provider_set_nameservers() function needs changes because we get the nameservers as an array, it makes no sense to convert the array to string and then back to array.
2013-03-27service: Disconnect the connecting service when neededJukka Rissanen1-2/+12
If we are trying to connect a service and there is another service connecting, then we disconnect the pending service and connect the new one. Fixes BMC#25981
2013-03-25tethering: Fix build with kernel headers 3.8+Yann E. MORIN1-0/+1
Highly inspired by: https://git.kernel.org/cgit/linux/kernel/git/shemminger/bridge-utils.git/commit/?id=5eebb7f9288b7881ffb929b1fd494fe3ac3be27d As Russel puts it in his commit message for bridge-utils: Linux 3.8 has a header, include/uapi/linux/if_bridge.h that uses a struct in6_addr but doesn't define it. The trivial seeming fix of including the header that does define it causes more problems. The problem was discussed on mailing lists in January 2013. The final suggestion I found was here: http://www.redhat.com/archives/libvir-list/2013-January/msg01253.html This is intended to implement that suggestion. This changeset transplants this trivial fix to connman.
2013-03-25service: Send IP config changed signal in disconnectJukka Rissanen1-0/+3
We did not send the IP config changed signal during disconnect. This can confuse the dbus signal listeners. Fixes BMC#25989
2013-03-25service: Only send correct ipconfig changed signalJukka Rissanen1-5/+10
If we are changing IPv4 config, then send only IPv4 changed signal and not the IPv6 one. Same is done for IPv6 config when it changes.
2013-03-25config: Allow user to specify how IP address is usedJukka Rissanen1-4/+36
If IPv4 address is missing then DHCPv4 is used. If IPv6 address is missing, then SLAAC or DHCPv6 is used. This was specified in doc/config-format.txt but implementation was missing. We also allow the IP address to contain "off", "dhcp" or "auto" string, so user can specify how the IP address can be set for the interface. Fixes BMC#25985
2013-03-25firewall: Maintain iptables rules in dedicated ConnMan chainsDaniel Wagner1-6/+174
Instead appending ConnMan iptables rules into the builtin chains we append them into chains managed by ConnMan. If a rule needs to be inserted into a bultin chain, ConnMan will create a 'connman-' prefixed builtin chain name and appends the user rules there. Then ConnMan will insert a unconditional jump rule in the builtin chain. Basically, iptables -t filter -A INPUT -m mark --mark 1 -j LOG will be translated to this: iptables -t filter -N connman-INPUT iptables -t filter -A connman-INPUT -m mark --mark 1 -j LOG iptables -t filter -I INPUT -j connman-INPUT When the last rule in a managed chain is removed, the managed chain will also be removed.
2013-03-25firewall: Add firewall APIDaniel Wagner2-0/+138
The main idea behind this API is to collect several iptables rules together and enable or disable in one go. For this a context is created via __connman_firewall_create() and the rules added to this context via __connman_firewall_add_rule(). In order to append all rules __connman_firewall_enable() has to be called. To remove all rules associated with one context __connman_firewall_disable() has to be used. If something goes awry the code tries to get back to the initial state.
2013-03-25firewall: Flush managed chainsDaniel Wagner1-0/+107
ConnMan maintains its own chain per builtin chain. The managed chain have a prefix 'connman-' and one rule in the corresponding builtin chain which jumps uncoditional to the managed chain. In case ConnMan crashed we need to cleanup first.
2013-03-25firewall: Add firewall fileDaniel Wagner3-0/+44
2013-03-25iptables: Add chain iteratorDaniel Wagner2-32/+20
We will implement the ConnMan iptables specific part in a different file and leave the iptables.c file as small as possible. Therefore, we move the flushing part out, but we need a way to find our chains on bootup (left over from a crash). Let's add an interater which walks over all chains which allows a higher level to find the chains it is looking for (e.g. connman-INPUT)
2013-03-25iptables: Add __connman_iptables_insert()Daniel Wagner2-0/+77
This was wrongly removed with commit 161efbae
2013-03-25iptables: Prepare rule to be inserted or appendedDaniel Wagner1-3/+4
Add a boolean helper to distinguish between insert and append operations. When chain_head == chain_tail->prev, the builtin chain is empty which makes an intended append operation equivalent to an insert operation.
2013-03-22dnsproxy: Make sure we are not accessing null hashJukka Rissanen1-0/+6
If dnsproxy is not in use, like when connman has been started with -r option, then the listener_table will be NULL which can cause crash in hash table lookup call.
2013-03-18iptables: Allocated memory blocks are already zerod outDaniel Wagner1-4/+0
entry_head and entry_return are allocated via g_try_malloc0().
2013-03-18iptables: Factor out duplicated update hook codeDaniel Wagner1-33/+27
After removing one or more rules the builtin hooks need to be updated accordingly. iptables_flush_chain() and iptables_delete_rule() share a common code part.
2013-03-18iptables: Fix invalid access to list after removing first ruleDaniel Wagner1-6/+16
The list pointer is invalid after remove_table_entry(). Since we entering the 'if' body only for the first rule in a builtin chain we can safely update list to point to the next element.
2013-03-18iptables: Rename pre_load_table() to get_table()Daniel Wagner1-12/+10
The second argument is not used anymore, let's remove it. The funciton name doesn't really match to its implementation, so it's also time to rename it.
2013-03-18iptables: Improve debug log outputDaniel Wagner1-4/+17
We need to see a bit more in detail what happens when CONNMAN_IPTABLES_DEBUG is not set, for example the removing/flushing during bootup. Also remove the DBG() from parse_rule_spec() because all callers already have a DBG(). So not much additional information here.
2013-03-18iptables: Lookup in table hash before module loadingDaniel Wagner1-10/+14
pre_load_table() is called always with table == NULL, we end up keep trying to load the kernel modules even though the table is already loaded. Therefore, move the lookup one level up.
2013-03-18iptables: Use glib function for string operationsDaniel Wagner1-31/+31
Streamline this file with the rest of ConnMan's code base.
2013-03-18iptables: Drop support for xtables < 1.4.11Daniel Wagner1-71/+0
The API changed between 1.4.10 (version code 5) and 1.4.11 (version code 6) and we needed to workaround with a bunch of ugly ifdefs. 1.4.11 was released on 26.05.2011 and even Debian testing ships 1.4.14 these days.
2013-03-18iptables: Add __connman_iptables_dump()Daniel Wagner2-0/+16
In order to allow our test tool iptables-tests to dump a table we need an dump function. The only user will be this tool. That allows the linker to remove this code, so no additional code size.
2013-03-14service: User cannot modify immutable serviceJukka Rissanen1-0/+15
If the service is provisioned via .config file, then user is only able to set the AutoConnect status of the service. All the other settings must be set from the .config file. Fixes BMC#25984
2013-03-08provider: New provider removal function callable from vpn pluginJukka Rissanen1-0/+13
2013-03-08provider: Change the name of provider remove functionJukka Rissanen3-3/+3
Following patch will introduce provider remove function that can be used from vpn plugin so rename the current removal function to reflect better its usage.
2013-03-08service: Send signal only if immutable flag value changesJukka Rissanen1-0/+4
2013-03-08provider: Function to set the immutable flagJukka Rissanen1-0/+13
2013-03-07device: Check positive device filter correctlyJukka Rissanen1-4/+10
The -i or --device command line option contains the device names that we should use. Unfortunately the check fails if there are multiple interfaces in that list and we ignore the interfaces instead. Fixes BMC#25979
2013-03-07iptables: Fix rule appendingDaniel Wagner1-9/+6
Commit ba052f1f "iptables: Add split out iptables commands" introduced a bug. __connman_iptables_append() should call iptables_append_rule() instead of iptables_insert_rule().
2013-03-07iptables: Valid policies are only ACCEPT and DROPDaniel Wagner1-1/+6
2013-03-07iptables: Fix setting policyDaniel Wagner1-1/+6
The policy is kept at the end of the chain not at the beginning. Currently, the code assumes that the builtin chain is empty.
2013-03-07iptables: Always update options tableDaniel Wagner1-4/+0
The linked list is tracking all loading modules. Since we do not unload once they are loaded (xtables does not support this), we might up leaving prepare_matches() before we update the option table. Since we carefully reset the global xtable state after executing one rule, this check is wrong, e.g. if we add to similar rules (same matches (mark, nfacct)). In this case the second rule would not be parsed correctly. Nasty nasty iptables parser!
2013-03-07iptables: Do not flush in the wrong orderDaniel Wagner1-0/+8
2013-03-07iptables: Fix and refactor iterate_entries()Daniel Wagner1-25/+46
Updating the builtin and hook index is more complex then one would expect. In order to be able to update them correctly we need also to pass in the underflow table to the iterate function. To improve the readability the valid_hook magic has been moved into next_hook_entry_index() which does exactly as the name says.
2013-03-07iptables: Fix is_fallthrough() checkDaniel Wagner1-2/+6
A fallthrough rule is one which has the default target name, does not have a verdict and is not a jump rule. is_fallthrough() is called excluslive from the insert path, thus the value of verdict will be 0 for a fallthrough rule.
2013-03-06service: Restart wispr on nameserver changeForest Bond1-0/+10
This is needed to make a service go online in the case where it was already connected and then manual IPv4 & nameservers settings are applied. In that case, wispr is restarted with the new IP settings, but the nameservers have not been set yet, so the wispr test fails and the service remains in ready state.
2013-02-26config: Add a function to provision mutable serviceTomasz Bursztyka1-2/+103
The point here is to create a virtual configuration, which does not come from a real file. This is a handy way for plugins to be able to provision services without creating any file on the FS. In case of a wifi configuration type and if connect is requested, it will trigger a scan, thus leading to a possible service being provisioned by such virtual configuration. If so and if connect was requested: the service will be asked to connect.
2013-02-26config: Make load service from each keyfile group as a functionTomasz Bursztyka1-17/+24