Re: Wireguard iOS crashes after upgrading to XCode 14

2022-12-05 Thread Jason A. Donenfeld
On Mon, Dec 5, 2022 at 6:15 PM Houman  wrote:
>
> Hi Jason,
>
> I was wondering if there are still any plans to focus on the Apple
> development and bring the repo more up-to-date, please.
>
> Since the latest major development on the Wireguard Linux repo seems
> to have finished by 31st October, I was wondering if Apple dev could
> be prioritised next, please.
>
> I can see there was an update to the License file a couple of weeks
> ago. But the last real commit on Apple repo is from Sep 2021.

Yes that's the next priority.


Re: Wireguard iOS crashes after upgrading to XCode 14

2022-12-05 Thread Houman
Hi Jason,

I was wondering if there are still any plans to focus on the Apple
development and bring the repo more up-to-date, please.

Since the latest major development on the Wireguard Linux repo seems
to have finished by 31st October, I was wondering if Apple dev could
be prioritised next, please.

I can see there was an update to the License file a couple of weeks
ago. But the last real commit on Apple repo is from Sep 2021.

Many Thanks,
Houman


On Thu, 22 Sept 2022 at 10:38, Jason A. Donenfeld  wrote:
>
> On 9/22/22, Houman  wrote:
> > Hi Andrej,
> >
> > It works, well done!
> >
> > A strange thing though, before your patch I was still able to connect
> > to the VPN server, if I changed the schema to Release instead of
> > Debug.  Now with your patch it also works under Debug schema, which is
> > fantastic.
> > What could be the technical reason that it still worked under Release?
> >
> > And what will happen now, are you able to actually get this patch
> > released on the official repo? The repo hasn't been updated for a
> > year.  :-)
> >
>
> Yeah, I'll circle back Apple development at some point. No worries.
>
> Jason


Re: Wireguard iOS crashes after upgrading to XCode 14

2022-09-22 Thread Houman
Thank you Andrej for explaining the reason. It makes sense.

Kind regards,
Houman

On Thu, 22 Sept 2022 at 10:44, Andrej Mihajlov  wrote:
>
> Hi Houman,
>
> I believe that the crash coming from withMemoryRebound is actually assertion 
> (assert()). Very often assertions are stripped out from release builds, so I 
> guess it could be the reason why it just worked in release builds.
>
> Jason has already replied in regards of releasing an update.
>
> Best regards,
> Andrej
>
> > On 22 Sep 2022, at 10:56, Houman  wrote:
> >
> > Hi Andrej,
> >
> > It works, well done!
> >
> > A strange thing though, before your patch I was still able to connect
> > to the VPN server, if I changed the schema to Release instead of
> > Debug.  Now with your patch it also works under Debug schema, which is
> > fantastic.
> > What could be the technical reason that it still worked under Release?
> >
> > And what will happen now, are you able to actually get this patch
> > released on the official repo? The repo hasn't been updated for a
> > year.  :-)
> >
> > Thanks,
> > Houman
> >
> >
> > On Thu, 22 Sept 2022 at 09:31, Andrej Mihajlov  wrote:
> >>
> >> Hi,
> >>
> >> I think we have a bug. If I am right, basically in both IPv4 and IPv6 
> >> extensions, withMemoryRebound takes capacity which is actually a number of 
> >> instances of a given type (sockaddr_ variant) and not the byte size of a 
> >> struct.
> >>
> >> Could you please patch your WireGuardKit with the following commit and see 
> >> if it helps?
> >>
> >> https://git.zx2c4.com/wireguard-apple/commit/?h=am/fix-addrinfo-crash
> >>
> >> Best regards,
> >> Andrey Mikhaylov
> >>
> >>> On 13 Sep 2022, at 14:41, Houman  wrote:
> >>>
> >>> My existing Wireguard iOS implementation stopped working after
> >>> upgrading to Xcode 14 today.
> >>> When trying to connect to servers that support only IPv4, then it's
> >>> fine. But if the server supports both IPv6 and IPv4 then the tunnel
> >>> crashes:
> >>>
> >>> This IPv6 extension in
> >>> wireguard-apple/Sources/WireGuardKit/IPAddress+AddrInfo.swift crashes
> >>> with a Fatal Error at addrInfo.ai_addr.withMemoryRebound()
> >>>
> >>> The whole extension below:
> >>>
> >>> extension IPv6Address {
> >>>   init?(addrInfo: addrinfo) {
> >>>   guard addrInfo.ai_family == AF_INET6 else { return nil }
> >>>
> >>>   let addressData = addrInfo.ai_addr.withMemoryRebound(to:
> >>> sockaddr_in6.self, capacity: MemoryLayout.size) { ptr ->
> >>> Data in
> >>>   return Data(bytes: &ptr.pointee.sin6_addr, count:
> >>> MemoryLayout.size)
> >>>   }
> >>>   self.init(addressData)
> >>>   }
> >>> }
> >>>
> >>> Has anyone else experienced this problem?
> >>>
> >>> Thanks,
> >>
>


Re: Wireguard iOS crashes after upgrading to XCode 14

2022-09-22 Thread Andrej Mihajlov
Hi Houman,

I believe that the crash coming from withMemoryRebound is actually assertion 
(assert()). Very often assertions are stripped out from release builds, so I 
guess it could be the reason why it just worked in release builds.

Jason has already replied in regards of releasing an update.

Best regards,
Andrej

> On 22 Sep 2022, at 10:56, Houman  wrote:
> 
> Hi Andrej,
> 
> It works, well done!
> 
> A strange thing though, before your patch I was still able to connect
> to the VPN server, if I changed the schema to Release instead of
> Debug.  Now with your patch it also works under Debug schema, which is
> fantastic.
> What could be the technical reason that it still worked under Release?
> 
> And what will happen now, are you able to actually get this patch
> released on the official repo? The repo hasn't been updated for a
> year.  :-)
> 
> Thanks,
> Houman
> 
> 
> On Thu, 22 Sept 2022 at 09:31, Andrej Mihajlov  wrote:
>> 
>> Hi,
>> 
>> I think we have a bug. If I am right, basically in both IPv4 and IPv6 
>> extensions, withMemoryRebound takes capacity which is actually a number of 
>> instances of a given type (sockaddr_ variant) and not the byte size of a 
>> struct.
>> 
>> Could you please patch your WireGuardKit with the following commit and see 
>> if it helps?
>> 
>> https://git.zx2c4.com/wireguard-apple/commit/?h=am/fix-addrinfo-crash
>> 
>> Best regards,
>> Andrey Mikhaylov
>> 
>>> On 13 Sep 2022, at 14:41, Houman  wrote:
>>> 
>>> My existing Wireguard iOS implementation stopped working after
>>> upgrading to Xcode 14 today.
>>> When trying to connect to servers that support only IPv4, then it's
>>> fine. But if the server supports both IPv6 and IPv4 then the tunnel
>>> crashes:
>>> 
>>> This IPv6 extension in
>>> wireguard-apple/Sources/WireGuardKit/IPAddress+AddrInfo.swift crashes
>>> with a Fatal Error at addrInfo.ai_addr.withMemoryRebound()
>>> 
>>> The whole extension below:
>>> 
>>> extension IPv6Address {
>>>   init?(addrInfo: addrinfo) {
>>>   guard addrInfo.ai_family == AF_INET6 else { return nil }
>>> 
>>>   let addressData = addrInfo.ai_addr.withMemoryRebound(to:
>>> sockaddr_in6.self, capacity: MemoryLayout.size) { ptr ->
>>> Data in
>>>   return Data(bytes: &ptr.pointee.sin6_addr, count:
>>> MemoryLayout.size)
>>>   }
>>>   self.init(addressData)
>>>   }
>>> }
>>> 
>>> Has anyone else experienced this problem?
>>> 
>>> Thanks,
>> 



Re: Wireguard iOS crashes after upgrading to XCode 14

2022-09-22 Thread Houman
Sounds good, thanks, Jason.

On Thu, 22 Sept 2022 at 10:38, Jason A. Donenfeld  wrote:
>
> On 9/22/22, Houman  wrote:
> > Hi Andrej,
> >
> > It works, well done!
> >
> > A strange thing though, before your patch I was still able to connect
> > to the VPN server, if I changed the schema to Release instead of
> > Debug.  Now with your patch it also works under Debug schema, which is
> > fantastic.
> > What could be the technical reason that it still worked under Release?
> >
> > And what will happen now, are you able to actually get this patch
> > released on the official repo? The repo hasn't been updated for a
> > year.  :-)
> >
>
> Yeah, I'll circle back Apple development at some point. No worries.
>
> Jason


Re: Wireguard iOS crashes after upgrading to XCode 14

2022-09-22 Thread Jason A. Donenfeld
On 9/22/22, Houman  wrote:
> Hi Andrej,
>
> It works, well done!
>
> A strange thing though, before your patch I was still able to connect
> to the VPN server, if I changed the schema to Release instead of
> Debug.  Now with your patch it also works under Debug schema, which is
> fantastic.
> What could be the technical reason that it still worked under Release?
>
> And what will happen now, are you able to actually get this patch
> released on the official repo? The repo hasn't been updated for a
> year.  :-)
>

Yeah, I'll circle back Apple development at some point. No worries.

Jason


Re: Wireguard iOS crashes after upgrading to XCode 14

2022-09-22 Thread Houman
Hi Andrej,

It works, well done!

A strange thing though, before your patch I was still able to connect
to the VPN server, if I changed the schema to Release instead of
Debug.  Now with your patch it also works under Debug schema, which is
fantastic.
What could be the technical reason that it still worked under Release?

And what will happen now, are you able to actually get this patch
released on the official repo? The repo hasn't been updated for a
year.  :-)

Thanks,
Houman


On Thu, 22 Sept 2022 at 09:31, Andrej Mihajlov  wrote:
>
> Hi,
>
> I think we have a bug. If I am right, basically in both IPv4 and IPv6 
> extensions, withMemoryRebound takes capacity which is actually a number of 
> instances of a given type (sockaddr_ variant) and not the byte size of a 
> struct.
>
> Could you please patch your WireGuardKit with the following commit and see if 
> it helps?
>
> https://git.zx2c4.com/wireguard-apple/commit/?h=am/fix-addrinfo-crash
>
> Best regards,
> Andrey Mikhaylov
>
> > On 13 Sep 2022, at 14:41, Houman  wrote:
> >
> > My existing Wireguard iOS implementation stopped working after
> > upgrading to Xcode 14 today.
> > When trying to connect to servers that support only IPv4, then it's
> > fine. But if the server supports both IPv6 and IPv4 then the tunnel
> > crashes:
> >
> > This IPv6 extension in
> > wireguard-apple/Sources/WireGuardKit/IPAddress+AddrInfo.swift crashes
> > with a Fatal Error at addrInfo.ai_addr.withMemoryRebound()
> >
> > The whole extension below:
> >
> > extension IPv6Address {
> >init?(addrInfo: addrinfo) {
> >guard addrInfo.ai_family == AF_INET6 else { return nil }
> >
> >let addressData = addrInfo.ai_addr.withMemoryRebound(to:
> > sockaddr_in6.self, capacity: MemoryLayout.size) { ptr ->
> > Data in
> >return Data(bytes: &ptr.pointee.sin6_addr, count:
> > MemoryLayout.size)
> >}
> >self.init(addressData)
> >}
> > }
> >
> > Has anyone else experienced this problem?
> >
> > Thanks,
>


Re: Wireguard iOS crashes after upgrading to XCode 14

2022-09-22 Thread Andrej Mihajlov
Hi,

I think we have a bug. If I am right, basically in both IPv4 and IPv6 
extensions, withMemoryRebound takes capacity which is actually a number of 
instances of a given type (sockaddr_ variant) and not the byte size of a 
struct. 

Could you please patch your WireGuardKit with the following commit and see if 
it helps? 

https://git.zx2c4.com/wireguard-apple/commit/?h=am/fix-addrinfo-crash

Best regards,
Andrey Mikhaylov

> On 13 Sep 2022, at 14:41, Houman  wrote:
> 
> My existing Wireguard iOS implementation stopped working after
> upgrading to Xcode 14 today.
> When trying to connect to servers that support only IPv4, then it's
> fine. But if the server supports both IPv6 and IPv4 then the tunnel
> crashes:
> 
> This IPv6 extension in
> wireguard-apple/Sources/WireGuardKit/IPAddress+AddrInfo.swift crashes
> with a Fatal Error at addrInfo.ai_addr.withMemoryRebound()
> 
> The whole extension below:
> 
> extension IPv6Address {
>init?(addrInfo: addrinfo) {
>guard addrInfo.ai_family == AF_INET6 else { return nil }
> 
>let addressData = addrInfo.ai_addr.withMemoryRebound(to:
> sockaddr_in6.self, capacity: MemoryLayout.size) { ptr ->
> Data in
>return Data(bytes: &ptr.pointee.sin6_addr, count:
> MemoryLayout.size)
>}
>self.init(addressData)
>}
> }
> 
> Has anyone else experienced this problem?
> 
> Thanks,



Wireguard iOS crashes after upgrading to XCode 14

2022-09-13 Thread Houman
My existing Wireguard iOS implementation stopped working after
upgrading to Xcode 14 today.
When trying to connect to servers that support only IPv4, then it's
fine. But if the server supports both IPv6 and IPv4 then the tunnel
crashes:

This IPv6 extension in
wireguard-apple/Sources/WireGuardKit/IPAddress+AddrInfo.swift crashes
with a Fatal Error at addrInfo.ai_addr.withMemoryRebound()

The whole extension below:

extension IPv6Address {
init?(addrInfo: addrinfo) {
guard addrInfo.ai_family == AF_INET6 else { return nil }

let addressData = addrInfo.ai_addr.withMemoryRebound(to:
sockaddr_in6.self, capacity: MemoryLayout.size) { ptr ->
Data in
return Data(bytes: &ptr.pointee.sin6_addr, count:
MemoryLayout.size)
}
self.init(addressData)
}
}

Has anyone else experienced this problem?

Thanks,