Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alignment Problem on ARM #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

lordrasmus
Copy link

if the address in addr_ptr is not aligned correctly, the wrong bytes are written on arm
replacing * operator with memcpy fixes the issue

Thank you for your contribution

You are welcome to open PR, but they are used for discussion only. All
patches must eventually go to the openvpn-devel mailing list for review:

Please send your patch using git-send-email. For example to send your latest commit to the list:

$ git send-email [email protected] HEAD~1

For details, see these Wiki articles:

   bytes are written
   replacing * operator with memcpy fixes the issue
@schwabe
Copy link
Contributor

schwabe commented Apr 7, 2017

Hm, the pointers point to uint32 in non-packed struct as far as I can see. How should the alignment get screwed here?

@lordrasmus
Copy link
Author

i didn't checked why the alignment is screwed

i'm using openvpn as a client with client-nat on an arm platform
openvpn 2.3.11 was working fine, the problem started after upgrading to 2.4.0

i'm in holiday this week but i remember what happened
i can investigate further why it happens when i'm back in my company

a ping with tcpdump and 2.3.11 looks like this

IP 1.2.3.4 > 5.6.7.8: ICMP echo request
was correctly translated to this
IP 1.2.3.4 > 192.168.100.5: ICMP echo request

after upgrade to 2.4.0 it was translated to this
IP 1.2.3.192 > 168.100.5.8: ICMP echo request

i loaded openvpn in gdb and checked the address of addr_ptr in client_nat_transform
the address was something like 0x...5

so maybe the fix has to be made somewhere else
i guess between 2.3.11 and 2.4.0 the alignment of the parameter ipbuf was changed

if it helps i can have a look at the generated assembler code and check how the address in addr_ptr ist used
but i guess i will find a instruction which needs a 4 or 8 byte alignment

@TinCanTech
Copy link
Contributor

The syntax of --client-nat has changed , possibly this is related.
Where alias had two parameters before, it now only supports one.

@lordrasmus
Copy link
Author

the config is pushed from the server like this

PUSH: Received control message: 'PUSH_REPLY,route 172.16.0.1,topology net30,ping 50,ping-restart 110,client-nat snat 10.100.101.0 255.255.255.0 10.10.0.0,route 172.16.0.0 255.255.192.0,ifconfig 172.16.0.50 172.16.0.49'

@ordex
Copy link
Member

ordex commented Sep 17, 2022

anybody knows if this is still a problem? Many people run openvpn on arm (including myself) and unaligned access was never reported. (But not sure who uses client-nat)

@cron2
Copy link
Contributor

cron2 commented Sep 23, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants