[PATCH] fixed noisy error Cannot read /proc/net/pnp Failed to open file
by Vasyl Vavrychuk
This error happend on every boot.
---
src/inet.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/inet.c b/src/inet.c
index dcd1ab24..80d96737 100644
--- a/src/inet.c
+++ b/src/inet.c
@@ -3233,6 +3233,9 @@ char **__connman_inet_get_pnp_nameservers(const char *pnp_file)
if (!pnp_file)
pnp_file = "/proc/net/pnp";
+ if (!g_file_test(pnp_file, G_FILE_TEST_EXISTS))
+ goto out;
+
if (!g_file_get_contents(pnp_file, &pnp, NULL, &error)) {
connman_error("%s: Cannot read %s %s\n", __func__,
pnp_file, error->message);
--
2.11.0
2 years, 6 months
[PATCH v2 00/27] implement Address Conflict Detection
by Christian Spielberger
This patch series implements Address Conflict Detection (ACD) according to
RFC-5227. The review comments of the RFC PATCH series (thanks Daniel!) have
been taken into account:
- building with make distcheck each patch
- move code from service.c to network.c
- added documentation for the DBus API (patch 21)
- other cleanup
Patches 1 to 6 are unrelated and move common code to src/shared and adds
utility functions.
Patch 7 to 17 adds new files for ACD functionality. The IPv4LL code in gdhcp was
used as a basis for implementing ACD.
High-level conflict handling is placed in network, Patches 18 to 20.
Patch 21 adds a DBus property to inform about ACD.
Patch 22 to 25 adds sending of DHCP decline message in case an address conflict
is detected.
Patch 26 is for sending dbus signal also after the address defend failed and
own ip address is lost.
Patch 27 adds a DHCP decline also if second DHCP lease also has a conflict.
Christian Spielberger (26):
shared: Add functions for random number generation
dhcp: Use shared get_random() function
shared: Add low-level ARP functions
shared/arp: Add function get_interface_mac_address()
shared/arp: Add random_ip()
inet: Add function connman_inet_is_ifup()
Add Address Conflict Detection support (RFC 5227)
acd: add struct acd_host
acd: add functions start/stop_listening
acd: add send_probe_packet
acd: add send_announce_packet
acd: add callback function pointers
acd: add acdhost_start and acdhost_stop
acd: add acd_defend_timeout and acd_announce_timeout
acd: add handling of received arp packets
acd: add callback registration
network: init and start of acd
network: add content of acd callback functions
network: add ipv4ll as fallback for acd
acd: add dbus property for address conflict
dhcp: add sending of DHCP decline
network: add function for delayed dhcp start
acd: add acdhost_get_conflicts_count
network: send DHCP decline in case of address conflict
acd: report address lost case per dbus also
network: also send DHCP DECLINE after second DHCP try
Peter Meerwald-Stadler (1):
doc: Add documentation for AddressConflictDetection
Makefile.am | 17 +-
doc/connman.conf.5.in | 10 +
doc/service-api.txt | 32 +++
gdhcp/client.c | 88 ++++----
gdhcp/common.c | 39 +---
gdhcp/gdhcp.h | 4 +-
gdhcp/ipv4ll.c | 88 +-------
gdhcp/ipv4ll.h | 55 -----
include/acd.h | 64 ++++++
include/inet.h | 1 +
include/network.h | 6 +
include/service.h | 1 +
src/acd.c | 577 ++++++++++++++++++++++++++++++++++++++++++++++++++
src/connman.h | 1 +
src/dhcp.c | 27 ++-
src/inet.c | 34 +++
src/main.c | 16 ++
src/network.c | 338 +++++++++++++++++++++++++++++
src/service.c | 11 +
src/shared/arp.c | 164 ++++++++++++++
src/shared/arp.h | 49 +++++
src/shared/random.c | 78 +++++++
src/shared/random.h | 30 +++
23 files changed, 1498 insertions(+), 232 deletions(-)
delete mode 100644 gdhcp/ipv4ll.h
create mode 100644 include/acd.h
create mode 100644 src/acd.c
create mode 100644 src/shared/arp.c
create mode 100644 src/shared/arp.h
create mode 100644 src/shared/random.c
create mode 100644 src/shared/random.h
--
2.7.4
2 years, 9 months
[PATCH] session: cleanup session_hash table on all error cases.
by Harish Jenny K N
Removing connman_session from 'session_hash' global hash
table is needed for all error cases in
session_policy_config_cb function.
This patch moves the g_hash_table_remove call to handle
in all error cases.
---
src/session.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/session.c b/src/session.c
index 5778225..834b3a6 100644
--- a/src/session.c
+++ b/src/session.c
@@ -1407,7 +1407,6 @@ static int session_policy_config_cb(struct connman_session *session,
session_methods, NULL, NULL,
session, NULL)) {
connman_error("Failed to register %s", session->session_path);
- g_hash_table_remove(session_hash, session->session_path);
err = -EINVAL;
goto err;
}
@@ -1434,6 +1433,7 @@ static int session_policy_config_cb(struct connman_session *session,
return 0;
err:
+ g_hash_table_remove(session_hash, session->session_path);
reply = __connman_error_failed(creation_data->pending, -err);
g_dbus_send_message(connection, reply);
creation_data->pending = NULL;
--
1.9.1
2 years, 9 months
[PATCH] ntp: Report error to upper layer
by Daniel Wagner
Inform the timeserver layer if there was an error. Without the error
reports the timeserver code assumes all is fine.
For example if the system does not suppoert IPv6 but we get an IPv6
NTP server address, start_ntp() will fail to create an IPv6 socket.
Let's report all error back so that timeserver is able to react on the
error.
Reported-by: Craig McQueen <craig.mcqueen(a)innerrange.com>
---
src/ntp.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/src/ntp.c b/src/ntp.c
index 3c40f6210b81..51ba9aac966e 100644
--- a/src/ntp.c
+++ b/src/ntp.c
@@ -195,6 +195,7 @@ static void send_packet(struct ntp_data *nd, struct sockaddr *server,
addr = (void *)&nd->timeserver_addr.sin6_addr;
} else {
connman_error("Family is neither ipv4 nor ipv6");
+ nd->cb(false, nd->user_data);
return;
}
@@ -221,6 +222,7 @@ static void send_packet(struct ntp_data *nd, struct sockaddr *server,
if (len != sizeof(msg)) {
connman_error("Broken time request for server %s",
inet_ntop(server->sa_family, addr, ipaddrstring, sizeof(ipaddrstring)));
+ nd->cb(false, nd->user_data);
return;
}
@@ -531,36 +533,31 @@ static void start_ntp(struct ntp_data *nd)
nd->transmit_fd = socket(family, SOCK_DGRAM | SOCK_CLOEXEC, 0);
if (nd->transmit_fd <= 0) {
- connman_error("Failed to open time server socket");
- return;
+ if (errno != EAFNOSUPPORT)
+ connman_error("Failed to open time server socket");
}
if (bind(nd->transmit_fd, (struct sockaddr *) addr, size) < 0) {
connman_error("Failed to bind time server socket");
- close(nd->transmit_fd);
- return;
+ goto err;
}
if (family == AF_INET) {
if (setsockopt(nd->transmit_fd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) < 0) {
connman_error("Failed to set type of service option");
- close(nd->transmit_fd);
- return;
+ goto err;
}
}
if (setsockopt(nd->transmit_fd, SOL_SOCKET, SO_TIMESTAMP, ×tamp,
sizeof(timestamp)) < 0) {
connman_error("Failed to enable timestamp support");
- close(nd->transmit_fd);
- return;
+ goto err;
}
channel = g_io_channel_unix_new(nd->transmit_fd);
- if (!channel) {
- close(nd->transmit_fd);
- return;
- }
+ if (!channel)
+ goto err;
g_io_channel_set_encoding(channel, NULL, NULL);
g_io_channel_set_buffered(channel, FALSE);
@@ -576,6 +573,14 @@ static void start_ntp(struct ntp_data *nd)
send:
send_packet(nd, (struct sockaddr*)&ntp_data->timeserver_addr,
NTP_SEND_TIMEOUT);
+ return;
+
+err:
+ if (nd->transmit_fd > 0)
+ close(nd->transmit_fd);
+
+ nd->cb(false, nd->user_data);
+ return;
}
int __connman_ntp_start(char *server, __connman_ntp_cb_t callback,
--
2.14.3
2 years, 10 months
How can apps select a service?
by 원덕재
Hello,
With connman is it possible that an specific application selects specific service ?
For example, I have two services as below and both are already connected.
# connmanctl technologies
/net/connman/technology/cellular
Name = Cellular
Type = cellular
Powered = True
Connected = True
Tethering = False
/net/connman/technology/ethernet
Name = Wired
Type = ethernet
Powered = True
Connected = True
Tethering = False
# connmanctl services
*AO KT cellular_450086350199092_context1
*AR Wired ethernet_00e04c361b16_cable
In case there are two applications(application_1 and application_2), default route is ethernet basically.
But, if application_1 towards to cellular, how can application handle it?
Applicaiton_1 -> cellular
Application_2 -> ethernet
I use connman v1.33.
Thank you,
DJ Won
2 years, 10 months
Connman very slow to reconnect after every warm reboot
by stef204
Connman 1.35
Linux 4.15.15
x86_64
Systemd 238.76
Been using Connman for 3 to 4 years now. Has always been reliable and stable.
Recently, some annoying issue has crept up: when I (warm) reboot, connman does not reconnect immediately but lags significantly, is slow to (re)connect, even after I login to the system.
Previously, Connman would already be on/connected once I logged in. (Referring to logging in to Linux system via login shell as normal user--Linux Console, no X, no display manager or DE interference.)
Starting about 2 or 3 versions back, on reboot, it does not connect for some time--and lags significantly before it finally connects. I can check it with "ping 8.8.8.8" for example, and I get the usual "Network Unreachable", etc. It takes time for Connman to come back "up".
I am thinking it "could " be related to the systemd connman.service unit but not sure; and I see that the seem to be provided upstream not by my distro.
% cat connman.service
[Unit]
Description=Connection service
DefaultDependencies=false
Conflicts=shutdown.target
RequiresMountsFor=/var/lib/connman
After=dbus.service network-pre.target systemd-sysusers.service
Before=network.target multi-user.target shutdown.target
Wants=network.target
[Service]
Type=dbus
BusName=net.connman
Restart=on-failure
ExecStart=/usr/bin/connmand -n
StandardOutput=null
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW CAP_SYS_TIME CAP_SYS_MODULE
ProtectHome=true
ProtectSystem=true
[Install]
WantedBy=multi-user.target
I cannot see anythin significant related to Connman in journalctl -b"
Couple of lines from the journal:
__connman_inet_get_pnp_nameservers: Cannot read /proc/net/pnp Failed to open file “/proc/net/pnp”: No such file or directory
Cannot create /var/run/connman/resolv.conf falling back to /etc/resolv.conf
Nothing in dmesg.
I've done the usual searches, and looked at the official docs; and through recent mailing list archive posts but have not found a solution yet.
I'd appreciate any feedback on how to troubleshoot and resolve this issue.
Please let me know what additional info I may need to provide to help the troubleshooting.
Thanks
2 years, 10 months
Setup without cable
by Vasiu Alexandru
Hi,
With connman is possible to set up an interface with static IP and so on,
if it's no service on that interface?
Thank you,
Alex
NI
2 years, 10 months
[PATCH 0/1] Start timeserver after late DHCP configuration
by Robert Tiemann
Hi,
we have discovered a problem with NTP servers not being used under
certain conditions. Here is how to reproduce our problem:
1. Device is using Ethernet, cable is plugged into a switch. No other
technologies are involved.
2. Make sure there is no DHCP server on the network.
3. Start ConnMan and let it try to connect via Ethernet using DHCP.
Autoconfiguration kicks in after some time, and the IP address is
set to 169.254.x.y.
4. Start DHCP server.
5. After some time, ConnMan obtains a lease and configures the wired
service according to data received from the DHCP server.
6. All settings, including timeserver, are correctly configured now,
but the timeserver is not started.
7. Replugging the Ethernet cable triggers new DHCP configuration, but
this time the timeserver is started.
I have tracked down the problem to function timeserver_start() in
src/timeserver.c. At autoconfiguration time (step 3), there are no
nameservers configured and timeserver_start() returns early, leaving
the resolv pointer NULL. Consequently, __connman_timeserver_sync()
fails each time it is called.
At the time ConnMan obtains a proper DHCP lease, function
default_changed() in timeserver.c is *not* called, but
__connman_timeserver_sync() is. The latter fails because the resolv
pointer is still NULL. At this time you have a working IP connection,
but the timeserver is not running at all.
Now, I think the timeserver should work even without any nameservers
configured because the timeserver(s) could be provided as raw IP
address(es). This patch changes timeserver_start() such that the
nameservers are optional and resolv is always allocated.
I suspect, however, that the timeserver_notifier should be notified as
well after having obtained the DHCP lease, right? I don't know,
however, where and how this should be done, or even if it would be
correct in the first place.
Best regards,
Robert
Robert Tiemann (1):
timeserver: List of nameservers may be empty
src/timeserver.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--
1.9.1
2 years, 10 months
[PATCH] service: retry online check for IPv4
by Daniel Mack
Occasionally. wacky wifi connections might drop the first packets after
they got their DHCP lease, but work stable afterwards. Be a bit more
patient and retry the IPv4 online check in case it failed in the first
attempt.
The change is straight forward. A new function named
__connman_service_wispr_start() is added to initialize the retry
counters for both v4 and v6, and all former call sites of
__connman_wispr_start() are now routed through
__connman_service_wispr_start().
---
src/connman.h | 2 ++
src/service.c | 83 ++++++++++++++++++++++++++++++++++++++++++++---------------
src/wispr.c | 2 +-
src/wpad.c | 4 +--
4 files changed, 67 insertions(+), 24 deletions(-)
diff --git a/src/connman.h b/src/connman.h
index 6d1831b1..82e77d37 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -689,6 +689,8 @@ struct connman_ipconfig *__connman_service_get_ipconfig(
struct connman_service *service, int family);
void __connman_service_notify_ipv4_configuration(
struct connman_service *service);
+void __connman_service_wispr_start(struct connman_service *service,
+ enum connman_ipconfig_type type);
bool __connman_service_is_connected_state(struct connman_service *service,
enum connman_ipconfig_type type);
const char *__connman_service_get_ident(struct connman_service *service);
diff --git a/src/service.c b/src/service.c
index 529be38c..23dcfbb0 100644
--- a/src/service.c
+++ b/src/service.c
@@ -127,7 +127,8 @@ struct connman_service {
char *pac;
bool wps;
bool wps_advertizing;
- int online_check_count;
+ int online_check_count_ipv4;
+ int online_check_count_ipv6;
bool do_split_routing;
bool new_service;
bool hidden_service;
@@ -3401,6 +3402,19 @@ int __connman_service_reset_ipconfig(struct connman_service *service,
return err;
}
+void __connman_service_wispr_start(struct connman_service *service,
+ enum connman_ipconfig_type type)
+{
+ DBG("service %p type %s", service, __connman_ipconfig_type2string(type));
+
+ if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
+ service->online_check_count_ipv4 = 1;
+ else
+ service->online_check_count_ipv6 = 1;
+
+ __connman_wispr_start(service, type);
+}
+
static DBusMessage *set_property(DBusConnection *conn,
DBusMessage *msg, void *user_data)
{
@@ -3518,13 +3532,11 @@ static DBusMessage *set_property(DBusConnection *conn,
if (__connman_service_is_connected_state(service,
CONNMAN_IPCONFIG_TYPE_IPV4))
- __connman_wispr_start(service,
- CONNMAN_IPCONFIG_TYPE_IPV4);
+ __connman_service_wispr_start(service, CONNMAN_IPCONFIG_TYPE_IPV4);
if (__connman_service_is_connected_state(service,
CONNMAN_IPCONFIG_TYPE_IPV6))
- __connman_wispr_start(service,
- CONNMAN_IPCONFIG_TYPE_IPV6);
+ __connman_service_wispr_start(service, CONNMAN_IPCONFIG_TYPE_IPV6);
service_save(service);
} else if (g_str_equal(name, "Timeservers.Configuration")) {
@@ -5918,7 +5930,7 @@ static void check_proxy_setup(struct connman_service *service)
return;
done:
- __connman_wispr_start(service, CONNMAN_IPCONFIG_TYPE_IPV4);
+ __connman_service_wispr_start(service, CONNMAN_IPCONFIG_TYPE_IPV4);
}
/*
@@ -5974,18 +5986,38 @@ static void service_rp_filter(struct connman_service *service,
connected_networks_count, original_rp_filter);
}
-static gboolean redo_wispr(gpointer user_data)
+static void redo_wispr(struct connman_service *service,
+ enum connman_ipconfig_type type)
{
- struct connman_service *service = user_data;
int refcount = service->refcount - 1;
connman_service_unref(service);
if (refcount == 0) {
DBG("Service %p already removed", service);
- return FALSE;
+ return;
}
- __connman_wispr_start(service, CONNMAN_IPCONFIG_TYPE_IPV6);
+ DBG("Retrying %s WISPr for %p %s",
+ __connman_ipconfig_type2string(type),
+ service, service->name);
+
+ __connman_wispr_start(service, type);
+}
+
+static gboolean redo_wispr_ipv4(gpointer user_data)
+{
+ struct connman_service *service = user_data;
+
+ redo_wispr(service, CONNMAN_IPCONFIG_TYPE_IPV4);
+
+ return FALSE;
+}
+
+static gboolean redo_wispr_ipv6(gpointer user_data)
+{
+ struct connman_service *service = user_data;
+
+ redo_wispr(service, CONNMAN_IPCONFIG_TYPE_IPV6);
return FALSE;
}
@@ -5993,25 +6025,35 @@ static gboolean redo_wispr(gpointer user_data)
int __connman_service_online_check_failed(struct connman_service *service,
enum connman_ipconfig_type type)
{
- DBG("service %p type %d count %d", service, type,
- service->online_check_count);
+ GSourceFunc redo_func;
+ int *count;
+
+ if (type == CONNMAN_IPCONFIG_TYPE_IPV4) {
+ count = &service->online_check_count_ipv4;
+ redo_func = redo_wispr_ipv4;
+ } else {
+ count = &service->online_check_count_ipv6;
+ redo_func = redo_wispr_ipv6;
+ }
+
+ DBG("service %p type %s count %d", service,
+ __connman_ipconfig_type2string(type), *count);
- /* currently we only retry IPv6 stuff */
- if (type == CONNMAN_IPCONFIG_TYPE_IPV4 ||
- service->online_check_count != 1) {
- connman_warn("Online check failed for %p %s", service,
- service->name);
+ if (*count == 0) {
+ connman_warn("%s online check failed for %p %s",
+ __connman_ipconfig_type2string(type),
+ service, service->name);
return 0;
}
- service->online_check_count = 0;
+ *count -= 1;
/*
* We set the timeout to 1 sec so that we have a chance to get
* necessary IPv6 router advertisement messages that might have
* DNS data etc.
*/
- g_timeout_add_seconds(1, redo_wispr, connman_service_ref(service));
+ g_timeout_add_seconds(1, redo_func, connman_service_ref(service));
return EAGAIN;
}
@@ -6089,8 +6131,7 @@ int __connman_service_ipconfig_indicate_state(struct connman_service *service,
if (type == CONNMAN_IPCONFIG_TYPE_IPV4) {
check_proxy_setup(service);
} else {
- service->online_check_count = 1;
- __connman_wispr_start(service, type);
+ __connman_service_wispr_start(service, type);
}
else
connman_info("Online check disabled. "
diff --git a/src/wispr.c b/src/wispr.c
index 03b38bb8..473c0e03 100644
--- a/src/wispr.c
+++ b/src/wispr.c
@@ -568,7 +568,7 @@ static void wispr_portal_browser_reply_cb(struct connman_service *service,
}
/* Restarting the test */
- __connman_wispr_start(service, wp_context->type);
+ __connman_service_wispr_start(service, wp_context->type);
}
static void wispr_portal_request_wispr_login(struct connman_service *service,
diff --git a/src/wpad.c b/src/wpad.c
index f066feee..54084ee8 100644
--- a/src/wpad.c
+++ b/src/wpad.c
@@ -87,7 +87,7 @@ static void wpad_result(GResolvResultStatus status,
g_free(url);
- __connman_wispr_start(wpad->service,
+ __connman_service_wispr_start(wpad->service,
CONNMAN_IPCONFIG_TYPE_IPV4);
return;
@@ -119,7 +119,7 @@ failed:
connman_service_set_proxy_method(wpad->service,
CONNMAN_SERVICE_PROXY_METHOD_DIRECT);
- __connman_wispr_start(wpad->service,
+ __connman_service_wispr_start(wpad->service,
CONNMAN_IPCONFIG_TYPE_IPV4);
}
--
2.14.3
2 years, 10 months
Connman unable to create /var/run/connman/resolv.conf
by stef204
As a side note to my other thread/post, I notice that connman is unable to create /var/run/connman/resolv.conf
It does not look possible to actually create the directory /var/run/connman although /var/run/connman-vpn/ does exists.
On my box (and distro), /var/run is a symlink to /run
I (naively) tried to create /run/connman but obviously this got deleted upon reboot and not recreated.
Connman falls back to /etc/resolv.conf which contains.... nothing.
% cat /etc/resolv/conf
# Generated by Connection Manager
Is the above expected? Or does it need fixing?
2 years, 10 months