diff mbox

[1/1] P2P: Ignore RTM_NEWLINK event for the P2P Discovery Interface

Message ID 5b014d8858cf9e4b703902a743588b51d3682e60.1402299980.git.jithu@broadcom.com
State Superseded
Headers show

Commit Message

Jithu Jance June 9, 2014, 8:26 a.m. UTC
Patch for Ignoring the RTM event for the dedicated P2P discovery
Interface. Without the patch the IFFUP operation on the interface
was failing (since there is no network device associated with the
interface).

Signed-off-by: Jithu Jance <jithu@broadcom.com>
---
 src/drivers/driver_nl80211.c |    5 +++++
 1 file changed, 5 insertions(+)

--
1.7.9.5

Comments

Jouni Malinen June 11, 2014, 9:30 p.m. UTC | #1
On Mon, Jun 09, 2014 at 01:26:42AM -0700, Jithu Jance wrote:
> Patch for Ignoring the RTM event for the dedicated P2P discovery
> Interface. Without the patch the IFFUP operation on the interface
> was failing (since there is no network device associated with the
> interface).

> +	if (drv->nlmode == NL80211_IFTYPE_P2P_DEVICE) {
> +		wpa_printf(MSG_INFO, "nl80211: Ignore RTM_NEWLINK for P2P Discovery Interface");
> +		return;
> +	}

Hmm.. How does NL82011_IFTYPE_P2P_DEVICE even get a RTM_NEWLINK event?
The main point of that was to not have a netdev.. Could you please share
a debug log showing what this looks like without this change?
Dmitry Shmidt June 13, 2014, 11:10 p.m. UTC | #2
On Wed, Jun 11, 2014 at 2:30 PM, Jouni Malinen <j@w1.fi> wrote:
> On Mon, Jun 09, 2014 at 01:26:42AM -0700, Jithu Jance wrote:
>> Patch for Ignoring the RTM event for the dedicated P2P discovery
>> Interface. Without the patch the IFFUP operation on the interface
>> was failing (since there is no network device associated with the
>> interface).
>
>> +     if (drv->nlmode == NL80211_IFTYPE_P2P_DEVICE) {
>> +             wpa_printf(MSG_INFO, "nl80211: Ignore RTM_NEWLINK for P2P Discovery Interface");
>> +             return;
>> +     }
>
> Hmm.. How does NL82011_IFTYPE_P2P_DEVICE even get a RTM_NEWLINK event?
> The main point of that was to not have a netdev.. Could you please share
> a debug log showing what this looks like without this change?

I think RTM_NEWLINK is received for group interface but this code fails it:

if (!drv->if_disabled && !(ifi->ifi_flags & IFF_UP)) {
                if (if_indextoname(ifi->ifi_index, namebuf) &&
                    linux_iface_up(drv->global->ioctl_sock,
                                   drv->first_bss->ifname) > 0) {  <<<< Here !!!
                        wpa_printf(MSG_DEBUG, "nl80211: Ignore interface down "
                                   "event since interface %s is up", namebuf);
                        return;
                }
                wpa_printf(MSG_DEBUG, "nl80211: Interface down");


Because namebuf == p2p-wlan0-0 and drv->first_bss->ifname == p2p-dev-wlan0,
where p2p-wlan0-0 is group interface, and p2p-dev-wlan0 is Non-NETDEV p2p.

>
> --
> Jouni Malinen                                            PGP id EFC895FA
> _______________________________________________
> HostAP mailing list
> HostAP@lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap
Dmitry Shmidt June 13, 2014, 11:48 p.m. UTC | #3
On Fri, Jun 13, 2014 at 4:10 PM, Dmitry Shmidt <dimitrysh@google.com> wrote:
> On Wed, Jun 11, 2014 at 2:30 PM, Jouni Malinen <j@w1.fi> wrote:
>> On Mon, Jun 09, 2014 at 01:26:42AM -0700, Jithu Jance wrote:
>>> Patch for Ignoring the RTM event for the dedicated P2P discovery
>>> Interface. Without the patch the IFFUP operation on the interface
>>> was failing (since there is no network device associated with the
>>> interface).
>>
>>> +     if (drv->nlmode == NL80211_IFTYPE_P2P_DEVICE) {
>>> +             wpa_printf(MSG_INFO, "nl80211: Ignore RTM_NEWLINK for P2P Discovery Interface");
>>> +             return;
>>> +     }
>>
>> Hmm.. How does NL82011_IFTYPE_P2P_DEVICE even get a RTM_NEWLINK event?
>> The main point of that was to not have a netdev.. Could you please share
>> a debug log showing what this looks like without this change?
>
> I think RTM_NEWLINK is received for group interface but this code fails it:
>
> if (!drv->if_disabled && !(ifi->ifi_flags & IFF_UP)) {
>                 if (if_indextoname(ifi->ifi_index, namebuf) &&
>                     linux_iface_up(drv->global->ioctl_sock,
>                                    drv->first_bss->ifname) > 0) {  <<<< Here !!!
>                         wpa_printf(MSG_DEBUG, "nl80211: Ignore interface down "
>                                    "event since interface %s is up", namebuf);
>                         return;
>                 }
>                 wpa_printf(MSG_DEBUG, "nl80211: Interface down");
>
>
> Because namebuf == p2p-wlan0-0 and drv->first_bss->ifname == p2p-dev-wlan0,
> where p2p-wlan0-0 is group interface, and p2p-dev-wlan0 is Non-NETDEV p2p.

It looks like this change
  http://hostap.epitest.fi/cgit/hostap/commit/?id=b36935be1a14341771b0fd5491808c3f6fdcb603
causes nl80211_find_drv() to return wrong pointer.

>
>>
>> --
>> Jouni Malinen                                            PGP id EFC895FA
>> _______________________________________________
>> HostAP mailing list
>> HostAP@lists.shmoo.com
>> http://lists.shmoo.com/mailman/listinfo/hostap
Jithu Jance June 14, 2014, 2:04 p.m. UTC | #4
Hi Dmitry & Jouni,

Thanks for looking into this. I think I didn't dig deep enough. I will
also check this and try to come up with a patch to address this.


Thanks,



> Jithu Jance





On Sat, Jun 14, 2014 at 5:18 AM, Dmitry Shmidt <dimitrysh@google.com> wrote:
> On Fri, Jun 13, 2014 at 4:10 PM, Dmitry Shmidt <dimitrysh@google.com> wrote:
>> On Wed, Jun 11, 2014 at 2:30 PM, Jouni Malinen <j@w1.fi> wrote:
>>> On Mon, Jun 09, 2014 at 01:26:42AM -0700, Jithu Jance wrote:
>>>> Patch for Ignoring the RTM event for the dedicated P2P discovery
>>>> Interface. Without the patch the IFFUP operation on the interface
>>>> was failing (since there is no network device associated with the
>>>> interface).
>>>
>>>> +     if (drv->nlmode == NL80211_IFTYPE_P2P_DEVICE) {
>>>> +             wpa_printf(MSG_INFO, "nl80211: Ignore RTM_NEWLINK for P2P Discovery Interface");
>>>> +             return;
>>>> +     }
>>>
>>> Hmm.. How does NL82011_IFTYPE_P2P_DEVICE even get a RTM_NEWLINK event?
>>> The main point of that was to not have a netdev.. Could you please share
>>> a debug log showing what this looks like without this change?
>>
>> I think RTM_NEWLINK is received for group interface but this code fails it:
>>
>> if (!drv->if_disabled && !(ifi->ifi_flags & IFF_UP)) {
>>                 if (if_indextoname(ifi->ifi_index, namebuf) &&
>>                     linux_iface_up(drv->global->ioctl_sock,
>>                                    drv->first_bss->ifname) > 0) {  <<<< Here !!!
>>                         wpa_printf(MSG_DEBUG, "nl80211: Ignore interface down "
>>                                    "event since interface %s is up", namebuf);
>>                         return;
>>                 }
>>                 wpa_printf(MSG_DEBUG, "nl80211: Interface down");
>>
>>
>> Because namebuf == p2p-wlan0-0 and drv->first_bss->ifname == p2p-dev-wlan0,
>> where p2p-wlan0-0 is group interface, and p2p-dev-wlan0 is Non-NETDEV p2p.
>
> It looks like this change
>   http://hostap.epitest.fi/cgit/hostap/commit/?id=b36935be1a14341771b0fd5491808c3f6fdcb603
> causes nl80211_find_drv() to return wrong pointer.
>
>>
>>>
>>> --
>>> Jouni Malinen                                            PGP id EFC895FA
>>> _______________________________________________
>>> HostAP mailing list
>>> HostAP@lists.shmoo.com
>>> http://lists.shmoo.com/mailman/listinfo/hostap
> _______________________________________________
> HostAP mailing list
> HostAP@lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap
diff mbox

Patch

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 709e13a..f4fa5d6 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1203,6 +1203,11 @@  static void wpa_driver_nl80211_event_rtm_newlink(void *ctx,
 		return;
 	}

+	if (drv->nlmode == NL80211_IFTYPE_P2P_DEVICE) {
+		wpa_printf(MSG_INFO, "nl80211: Ignore RTM_NEWLINK for P2P Discovery Interface");
+		return;
+	}
+
 	extra[0] = '\0';
 	pos = extra;
 	end = pos + sizeof(extra);