#!/bin/sh #### Script to enable IPv6 PDP context and set up IPv6 GPRS Interface #### # # # Authors: Fuad Abinader (ext-fuad.junior@nokia.com) # # Vinicius Pinto (ext-vinicius.pinto@nokia.com) # # Company: INdT - Instituto NOKIA de Tecnologia # # Date: 04/27/2010 # # Realease: 1.2 # # # ########################################################################## ### IPv4 APN value to hook up when activating IPv6 APN ### MY_IPv4_APN="internet.tusmobil.si" ### IPv6 APN value ### MY_IPv6_APN="ipv6.tusmobil.si" ### IPv6 APN username ### MY_IPv6_USERNAME="indt" ### IPv6 APN password ### MY_IPv6_PASSWORD="indt" ### Add prioritary IPv6-specific DNS server? ### ADD_IPv6_DNS="no" ### Prioritary IPv6-specific DNS server ### IPv6_DNS="2a02:840::2" ### Get gprs interface name (i.e. gprs0 or gprs1) from active PDP context ### INT_NAME=$(dbus-send --system --print-reply --dest=com.nokia.csd.GPRS /com/nokia/csd/gprs com.nokia.csd.GPRS.GetStatus | grep string | cut -d '"' -f 2 | awk 'NR==3') ### Get APN name from active PDP context ### APN_NAME=$(dbus-send --system --print-reply --dest=com.nokia.csd.GPRS /com/nokia/csd/gprs com.nokia.csd.GPRS.GetStatus | grep string | cut -d '"' -f 2 | awk 'NR==1') ### If interface name is gprs0 and apn equal to your IPv4 APN value then come up IPv6 PDP context and interface ### if [ $INT_NAME == "gprs0" ] && [ $APN_NAME == $MY_IPv4_APN ]; then /usr/bin/dbus-send --system --print-reply --dest=com.nokia.csd.GPRS /com/nokia/csd/gprs com.nokia.csd.GPRS.Attach /usr/bin/dbus-send --system --print-reply --dest=com.nokia.csd.GPRS /com/nokia/csd/gprs com.nokia.csd.GPRS.QuickConnect string:$MY_IPv6_APN string:IPv6 string:$MY_IPv6_U /usr/bin/dbus-send --system --print-reply --dest=com.nokia.csd.GPRS /com/nokia/csd/gprs com.nokia.csd.GPRS.GetStatus ip6_string=$(dbus-send --system --print-reply --dest=com.nokia.csd.GPRS /com/nokia/csd/gprs com.nokia.csd.GPRS.GetStatus | grep string | cut -d '"' -f 2 | tail -1) /sbin/ifconfig gprs1 $ip6_string up else exit 0 fi ### Adding IPv6 DNS to the /var/run/resolv.conf.gprs file ### if [ $ADD_IPv6_DNS == "yes" ]; then /bin/mv /var/run/resolv.conf.gprs /var/run/resolv.conf.gprs.old /bin/touch /var/run/resolv.conf.gprs echo "nameserver "$IPv6_DNS >> /var/run/resolv.conf.gprs cat /var/run/resolv.conf.gprs.old >> /var/run/resolv.conf.gprs fi