[Networking] realm_01:
Hi everyone,

This thread is obsolete because I found a solution check out my app here: http://xdaforums.com/android/apps-games/app-dhcpv6-client-t3176443

This is port of Roy Marples dhcpcd client for Android.

Background:

The fact that Android doesn't support DHCPv6 is for many system administrators an eyesore.

The guys from google don't plan to implement this feature very soon or not at all. See https code.google.com/p/android/issues/detail?id=32621

Because of this I decided to cross compile the dhcpcd client from Roy Marples for android.

source: http roy.marples.name/projects/dhcpcd/home

This client was tested on my Nexus 5 with:

Chroma ROM (build from 05-06-2015 with Android 5.1.1)

3.4.107 UBER-L Kernel

Working

Execution of dhcpcd

Optaining AND setting IPv4 address

Optaining IPv6 address (but not assigning the address to an interface)

NOT Working

Assigning IPv6 address to an interface

running as dhcp user (will give you permission denied on the interfaces)

as replacement for the stock client (see below)

Installation

Connect your phone to your PC

Open an adb shell (adb shell)

ON PHONE:

Make a folder for the dhcp client

cd /sdcard && mkdir dhcpcd

ON COMPUTER:

Copy files to phone

adb push roy-marples-dhcpcd-android.tar.gz /sdcard/dhcpcd

ON PHONE:

cd /sdcard/dhcpcd

extract roy-marples-dhcpcd-android.tar.gz

tar -xf roy-marples-dhcpcd-android.tar.gz

aquire root

su

remount /system rw

mount -o remount,rw /system

copy dhcpcd client

cp out/system/bin/dhcpcd /system/bin/dhcpcd6

DO NOT OVERWRITE THE STOCK DHCP CLIENT!!!!!

Copy all other files and create folders

mkdir /data/misc/dhcp6 && mkdir /system/etc/dhcpcd6

cp out/system/etc/dhcpcd6/* /system/etc/dhcpcd6/.

copy required libs

cp libs/* /system/lib

setting permissions

chmod 755 /system/bin/dhcpcd6

chown root:shell /system/bin/dhcpcd6

chmod 644 /system/lib/ld-linux-armhf.so.3

chmod 644 /system/lib/libc.so.6

chmod 755 /system/etc/dhcpcd6

chmod 550 /system/etc/dhcpcd6/dhcpcd-run-hooks

chmod 644 /system/etc/dhcpcd6/dhcpcd.conf

chmod 770 /data/misc/dhcp6

chown dhcp:dhcp /data/misc/dhcp6

Behavior

dhcpcd - stock dhcp client

dhcpcd6 - my cross compiled dhcp client

This client will not work without the stock dhcpcd client for some reason.

When killing dhcpcd and connecting to a w-lan network dhcpcd will be started, you can then call dhcpcd6 and you will get a secondary IPv4 address, however you can get but not set an IPv6 address, see Issues to fix.

If you replace dhcpcd with dhcpcd6, android will not invoke a dhcpcd process, when connecting to a network, also manually over command line by calling dhpcd will not get an IP address.

If dhcpcd6 is invoked by the dhcp user (su dhcp -c "/system/bin/dhcpcd6") will give a permission denied at the interfaces for some reason.

Issues to Fix

You can obtain an IPv6 address but you can not assign it to an interface for some reason:

wlan0: soliciting a DHCPv6 lease
wlan0: ADV xxxx:67c:xxxx:52cc:xxxx::1419/128 from xxxx:67c:xxxx:52cc:xxxx::1
wlan0: REPLY6 received from xxxx:67c:xxxx:52cc:xxxx::1
wlan0: adding address xxxx:67c:xxxx:52cc:xxxx::1419/128
if_addaddress6: Invalid argument

I went through the source code and found out that the problem might come from the sendmsg function which basically sends data through a socket: if-linux.c line 865

Any advice would be appreciated :)

Troubleshooting

If you get something like this:

wlan0: Router Advertisement from 1234::1234:xxxx:xxxx:xxxx
wlan0: ignoring RA from 1234::1234:xxxx:xxxx:xxxx (no public prefix, no managed address)

Add ipv6ra_accept_nopublic to the /system/etc/dhcpcd6/dhcpcd.conf file

Help needed! :)

Basically just how to get it fully working

Any advise would be appreciated :)

Compiled with:

Compiled on: x86_64 GNU/Linux (Debian Jessie)

arm-linux-gnueabihf-

package: binutils-arm-linux-gnueabihf

preconfigure.sh

export CROSS_TARGET=arm-linux-gnueabihf

export CC="${CROSS_TARGET}-gcc-5"
## export CXX="${CROSS_TARGET}-g++"
export AR="${CROSS_TARGET}-ar"
export AS="${CROSS_TARGET}-as"
export LD="${CROSS_TARGET}-ld"
export RANLIB="${CROSS_TARGET}-ranlib"
export READELF="${CROSS_TARGET}-readelf"
export STRIP="${CROSS_TARGET}-strip"

Compile:

./configure --host=arm-linux-gnueabihf --enable-static --enable-ipv4 --enable-ipv6 --enable-embedded --sysconfdir=/system/etc/dhcpcd6 --bindir=/system/bin --libexecdir=/system/etc/dhcpcd6 --statedir=/data/misc/dhcp6 --dbdir=/data/misc/dhcp6 --rundir=/data/misc/dhcp6 --libdir=/system/lib
make -j2 ARCH=arm
mkdir out
make install DESTDIR=out

Thanks To:

Roy Maprles - for the source of his dhcp client

-realm_01

Edit 1 10:20 17-06-2015

I rebuilded the dhcpcd client with some changes in the directories, also I figured out what why I can't assign a IPv6 address

This thread is obsolete because I found a solution check out my app here: http://xdaforums.com/android/apps-games/app-dhcpv6-client-t3176443