Kurchi Hazra | 17 Apr 2012 20:47
Picon
Favicon

Code Review Request: 7158636: InterfaceAddress.getBroadcast() returns invalid broadcast address on WLAN

Hi,

In Windows Vista and later, InterfaceAddress.getBroadcast() returns 
0.0.0.0 , since these platforms return IF_TYPE_IEEE80211 instead of
MIB_IF_TYPE_ETHERNET for wireless interface type now. The fix is to 
handle IF_TYPE_IEEE80211 in the relevant switch
statement. While doing this, I also updated some other parts of the code 
in the same file that depended on the value of the wireless interface type.

Although I have defined IF_TYPE_IEEE80211 in NetworkInterface.c, I am 
not sure if it is better to put it in NetworkInterface.h instead.

Bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7158636
Webrev: http://cr.openjdk.java.net/~khazra/7158636/webrev.00/

Thanks,
Kurchi

Chris Hegarty | 17 Apr 2012 20:56
Picon
Favicon

Re: Code Review Request: 7158636: InterfaceAddress.getBroadcast() returns invalid broadcast address on WLAN

On 17/04/12 19:47, Kurchi Hazra wrote:
> Hi,
>
> In Windows Vista and later, InterfaceAddress.getBroadcast() returns
> 0.0.0.0 , since these platforms return IF_TYPE_IEEE80211 instead of
> MIB_IF_TYPE_ETHERNET for wireless interface type now. The fix is to
> handle IF_TYPE_IEEE80211 in the relevant switch
> statement. While doing this, I also updated some other parts of the code
> in the same file that depended on the value of the wireless interface type.
>
> Although I have defined IF_TYPE_IEEE80211 in NetworkInterface.c, I am
> not sure if it is better to put it in NetworkInterface.h instead.

Right, probably better in the .h file. Otherwise, looks fine.

-Chris.

>
> Bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7158636
> Webrev: http://cr.openjdk.java.net/~khazra/7158636/webrev.00/
>
> Thanks,
> Kurchi
>

Alan Bateman | 17 Apr 2012 21:14
Picon
Favicon

Re: Code Review Request: 7158636: InterfaceAddress.getBroadcast() returns invalid broadcast address on WLAN

On 17/04/2012 19:47, Kurchi Hazra wrote:
> Hi,
>
> In Windows Vista and later, InterfaceAddress.getBroadcast() returns 
> 0.0.0.0 , since these platforms return IF_TYPE_IEEE80211 instead of
> MIB_IF_TYPE_ETHERNET for wireless interface type now. The fix is to 
> handle IF_TYPE_IEEE80211 in the relevant switch
> statement. While doing this, I also updated some other parts of the 
> code in the same file that depended on the value of the wireless 
> interface type.
>
> Although I have defined IF_TYPE_IEEE80211 in NetworkInterface.c, I am 
> not sure if it is better to put it in NetworkInterface.h instead.
>
> Bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7158636
> Webrev: http://cr.openjdk.java.net/~khazra/7158636/webrev.00/
>
> Thanks,
> Kurchi
>
Looks okay to me although I would like to see this code changed to snprintf.

I don't have a strong opinion on where IF_TYPE_IEEE80211 is defined.

-Alan

Chris Hegarty | 17 Apr 2012 21:24
Picon
Favicon

Re: Code Review Request: 7158636: InterfaceAddress.getBroadcast() returns invalid broadcast address on WLAN

On 17/04/12 20:14, Alan Bateman wrote:
> On 17/04/2012 19:47, Kurchi Hazra wrote:
>> Hi,
>>
>> In Windows Vista and later, InterfaceAddress.getBroadcast() returns
>> 0.0.0.0 , since these platforms return IF_TYPE_IEEE80211 instead of
>> MIB_IF_TYPE_ETHERNET for wireless interface type now. The fix is to
>> handle IF_TYPE_IEEE80211 in the relevant switch
>> statement. While doing this, I also updated some other parts of the
>> code in the same file that depended on the value of the wireless
>> interface type.
>>
>> Although I have defined IF_TYPE_IEEE80211 in NetworkInterface.c, I am
>> not sure if it is better to put it in NetworkInterface.h instead.
>>
>> Bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7158636
>> Webrev: http://cr.openjdk.java.net/~khazra/7158636/webrev.00/
>>
>> Thanks,
>> Kurchi
>>
> Looks okay to me although I would like to see this code changed to
> snprintf.

D'oh, good catch.

-Chris.

>
> I don't have a strong opinion on where IF_TYPE_IEEE80211 is defined.
(Continue reading)

Kurchi Hazra | 17 Apr 2012 23:34
Picon
Favicon

Re: Code Review Request: 7158636: InterfaceAddress.getBroadcast() returns invalid broadcast address on WLAN

Updated webrev: http://cr.openjdk.java.net/~khazra/7158636/webrev.01/

Windows has a more secure version of snprintf and I used that: 
http://msdn.microsoft.com/en-us/library/f30dzcf6%28v=vs.110%29.aspx

Thanks,
Kurchi

On 4/17/2012 12:24 PM, Chris Hegarty wrote:
> On 17/04/12 20:14, Alan Bateman wrote:
>> On 17/04/2012 19:47, Kurchi Hazra wrote:
>>> Hi,
>>>
>>> In Windows Vista and later, InterfaceAddress.getBroadcast() returns
>>> 0.0.0.0 , since these platforms return IF_TYPE_IEEE80211 instead of
>>> MIB_IF_TYPE_ETHERNET for wireless interface type now. The fix is to
>>> handle IF_TYPE_IEEE80211 in the relevant switch
>>> statement. While doing this, I also updated some other parts of the
>>> code in the same file that depended on the value of the wireless
>>> interface type.
>>>
>>> Although I have defined IF_TYPE_IEEE80211 in NetworkInterface.c, I am
>>> not sure if it is better to put it in NetworkInterface.h instead.
>>>
>>> Bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7158636
>>> Webrev: http://cr.openjdk.java.net/~khazra/7158636/webrev.00/
>>>
>>> Thanks,
>>> Kurchi
>>>
(Continue reading)

Chris Hegarty | 18 Apr 2012 15:00
Picon
Favicon

Re: Code Review Request: 7158636: InterfaceAddress.getBroadcast() returns invalid broadcast address on WLAN

Thanks Kurchi, I think this change should be fine.

-Chris.

On 17/04/2012 22:34, Kurchi Hazra wrote:
> Updated webrev: http://cr.openjdk.java.net/~khazra/7158636/webrev.01/
>
> Windows has a more secure version of snprintf and I used that:
> http://msdn.microsoft.com/en-us/library/f30dzcf6%28v=vs.110%29.aspx
>
> Thanks,
> Kurchi
>
>
> On 4/17/2012 12:24 PM, Chris Hegarty wrote:
>> On 17/04/12 20:14, Alan Bateman wrote:
>>> On 17/04/2012 19:47, Kurchi Hazra wrote:
>>>> Hi,
>>>>
>>>> In Windows Vista and later, InterfaceAddress.getBroadcast() returns
>>>> 0.0.0.0 , since these platforms return IF_TYPE_IEEE80211 instead of
>>>> MIB_IF_TYPE_ETHERNET for wireless interface type now. The fix is to
>>>> handle IF_TYPE_IEEE80211 in the relevant switch
>>>> statement. While doing this, I also updated some other parts of the
>>>> code in the same file that depended on the value of the wireless
>>>> interface type.
>>>>
>>>> Although I have defined IF_TYPE_IEEE80211 in NetworkInterface.c, I am
>>>> not sure if it is better to put it in NetworkInterface.h instead.
>>>>
(Continue reading)


Gmane