* [RFC] gatchat: Print error message if opening tun failes
@ 2012-08-21 6:00 Daniel Wagner
2012-08-21 13:00 ` Marcel Holtmann
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Wagner @ 2012-08-21 6:00 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 824 bytes --]
From: Daniel Wagner <daniel.wagner@bmw-carit.de>
This is a very common misstake. Let's help the users to
configure their system correctly.
---
gatchat/ppp_net.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/gatchat/ppp_net.c b/gatchat/ppp_net.c
index 1609b99..7082de7 100644
--- a/gatchat/ppp_net.c
+++ b/gatchat/ppp_net.c
@@ -155,8 +155,12 @@ struct ppp_net *ppp_net_new(GAtPPP *ppp, int fd)
if (fd < 0) {
/* open a tun interface */
fd = open("/dev/net/tun", O_RDWR);
- if (fd < 0)
+ if (fd < 0) {
+ fprintf(stderr, "Couldn't open tun device. "
+ "Do you run oFono as root and do you "
+ "have the TUN module loaded?");
goto error;
+ }
ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
strcpy(ifr.ifr_name, "ppp%d");
--
1.7.12.rc1.16.g05a20c8
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [RFC] gatchat: Print error message if opening tun failes
2012-08-21 6:00 [RFC] gatchat: Print error message if opening tun failes Daniel Wagner
@ 2012-08-21 13:00 ` Marcel Holtmann
2012-08-21 15:06 ` Daniel Wagner
2012-08-21 15:09 ` Daniel Wagner
0 siblings, 2 replies; 5+ messages in thread
From: Marcel Holtmann @ 2012-08-21 13:00 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 904 bytes --]
Hi Daniel,
> This is a very common misstake. Let's help the users to
> configure their system correctly.
> ---
> gatchat/ppp_net.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/gatchat/ppp_net.c b/gatchat/ppp_net.c
> index 1609b99..7082de7 100644
> --- a/gatchat/ppp_net.c
> +++ b/gatchat/ppp_net.c
> @@ -155,8 +155,12 @@ struct ppp_net *ppp_net_new(GAtPPP *ppp, int fd)
> if (fd < 0) {
> /* open a tun interface */
> fd = open("/dev/net/tun", O_RDWR);
> - if (fd < 0)
> + if (fd < 0) {
> + fprintf(stderr, "Couldn't open tun device. "
> + "Do you run oFono as root and do you "
> + "have the TUN module loaded?");
really, stderr?
> goto error;
> + }
>
> ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
> strcpy(ifr.ifr_name, "ppp%d");
Aren't the atom drivers checking this case for you?
Regards
Marcel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC] gatchat: Print error message if opening tun failes
2012-08-21 13:00 ` Marcel Holtmann
@ 2012-08-21 15:06 ` Daniel Wagner
2012-08-21 15:09 ` Daniel Wagner
1 sibling, 0 replies; 5+ messages in thread
From: Daniel Wagner @ 2012-08-21 15:06 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1289 bytes --]
Hi Marcel,
On 21.08.2012 15:00, Marcel Holtmann wrote:
>> This is a very common misstake. Let's help the users to
>> configure their system correctly.
>> ---
>> gatchat/ppp_net.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/gatchat/ppp_net.c b/gatchat/ppp_net.c
>> index 1609b99..7082de7 100644
>> --- a/gatchat/ppp_net.c
>> +++ b/gatchat/ppp_net.c
>> @@ -155,8 +155,12 @@ struct ppp_net *ppp_net_new(GAtPPP *ppp, int fd)
>> if (fd < 0) {
>> /* open a tun interface */
>> fd = open("/dev/net/tun", O_RDWR);
>> - if (fd < 0)
>> + if (fd < 0) {
>> + fprintf(stderr, "Couldn't open tun device. "
>> + "Do you run oFono as root and do you "
>> + "have the TUN module loaded?");
>
> really, stderr?
I was not sure what 'channel' to use to report something from gatchat.
Would g_print() be the right choice?
>> goto error;
>> + }
>>
>> ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
>> strcpy(ifr.ifr_name, "ppp%d");
>
> Aren't the atom drivers checking this case for you?
I don't know, but I had the exactly the same problem and I am pretty
sure that there was not log entry in any kind. If there is better place
to add such a log entry, I happy to send a patch.
cheers,
daniel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC] gatchat: Print error message if opening tun failes
2012-08-21 13:00 ` Marcel Holtmann
2012-08-21 15:06 ` Daniel Wagner
@ 2012-08-21 15:09 ` Daniel Wagner
2012-08-21 19:34 ` Denis Kenzior
1 sibling, 1 reply; 5+ messages in thread
From: Daniel Wagner @ 2012-08-21 15:09 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1353 bytes --]
Hi Marcel,
[sorry, a resend, ofono doesn't like non subscriber to post]
On 21.08.2012 15:00, Marcel Holtmann wrote:
>> This is a very common misstake. Let's help the users to
>> configure their system correctly.
>> ---
>> gatchat/ppp_net.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/gatchat/ppp_net.c b/gatchat/ppp_net.c
>> index 1609b99..7082de7 100644
>> --- a/gatchat/ppp_net.c
>> +++ b/gatchat/ppp_net.c
>> @@ -155,8 +155,12 @@ struct ppp_net *ppp_net_new(GAtPPP *ppp, int fd)
>> if (fd < 0) {
>> /* open a tun interface */
>> fd = open("/dev/net/tun", O_RDWR);
>> - if (fd < 0)
>> + if (fd < 0) {
>> + fprintf(stderr, "Couldn't open tun device. "
>> + "Do you run oFono as root and do you "
>> + "have the TUN module loaded?");
>
> really, stderr?
I was not sure what 'channel' to use to report something from gatchat.
Would g_print() be the right choice?
>> goto error;
>> + }
>>
>> ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
>> strcpy(ifr.ifr_name, "ppp%d");
>
> Aren't the atom drivers checking this case for you?
I don't know, but I had the exactly the same problem and I am pretty
sure that there was not log entry in any kind. If there is better place
to add such a log entry, I happy to send a patch.
cheers,
daniel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC] gatchat: Print error message if opening tun failes
2012-08-21 15:09 ` Daniel Wagner
@ 2012-08-21 19:34 ` Denis Kenzior
0 siblings, 0 replies; 5+ messages in thread
From: Denis Kenzior @ 2012-08-21 19:34 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1589 bytes --]
Hi Daniel,
On 08/21/2012 10:09 AM, Daniel Wagner wrote:
> Hi Marcel,
>
> [sorry, a resend, ofono doesn't like non subscriber to post]
>
> On 21.08.2012 15:00, Marcel Holtmann wrote:
>>> This is a very common misstake. Let's help the users to
>>> configure their system correctly.
>>> ---
>>> gatchat/ppp_net.c | 6 +++++-
>>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/gatchat/ppp_net.c b/gatchat/ppp_net.c
>>> index 1609b99..7082de7 100644
>>> --- a/gatchat/ppp_net.c
>>> +++ b/gatchat/ppp_net.c
>>> @@ -155,8 +155,12 @@ struct ppp_net *ppp_net_new(GAtPPP *ppp, int fd)
>>> if (fd < 0) {
>>> /* open a tun interface */
>>> fd = open("/dev/net/tun", O_RDWR);
>>> - if (fd < 0)
>>> + if (fd < 0) {
>>> + fprintf(stderr, "Couldn't open tun device. "
>>> + "Do you run oFono as root and do you "
>>> + "have the TUN module loaded?");
>>
>> really, stderr?
>
> I was not sure what 'channel' to use to report something from gatchat.
> Would g_print() be the right choice?
>
ppp_debug would be best
>>> goto error;
>>> + }
>>>
>>> ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
>>> strcpy(ifr.ifr_name, "ppp%d");
>>
>> Aren't the atom drivers checking this case for you?
>
> I don't know, but I had the exactly the same problem and I am pretty
> sure that there was not log entry in any kind. If there is better place
> to add such a log entry, I happy to send a patch.
>
There is a check for TUN inside drivers/atmodem/gprs-context.c
at_gprs_context_probe(). Why it isn't being triggered I do not know.
Regards,
-Denis
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-08-21 19:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-21 6:00 [RFC] gatchat: Print error message if opening tun failes Daniel Wagner
2012-08-21 13:00 ` Marcel Holtmann
2012-08-21 15:06 ` Daniel Wagner
2012-08-21 15:09 ` Daniel Wagner
2012-08-21 19:34 ` Denis Kenzior
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.