[gogoc] Adjust output scraping to match current ifconfig. Closes bug #983052

Juan Orti jorti at fedoraproject.org
Fri Jul 12 14:40:06 UTC 2013


commit dd001beb90dfff8bc50646a096d565bfadd792e9
Author: Juan Orti Alcaine <jorti at fedoraproject.org>
Date:   Fri Jul 12 16:35:49 2013 +0200

    Adjust output scraping to match current ifconfig. Closes bug #983052
    
    "FeRD (Frank Dana)" <ferdnyc at gmail.com>
    
    Description of problem:
    The gogoc client runs a script /etc/gogoc/template/linux.sh to configure
    the network upon successfully authenticating to the tunnelbroker. This
    script parses the output of ifconfig to determine configured interface
    addresses and adjust them accordingly. However, its assumptions about
    the format of ifconfig output are out of date, causing the script to
    fail before completion.
    
    The attached patch properly scrapes the output of ifconfig, so that
    valid command invocations are constructed from the results.
    
    Version-Release number of selected component (if applicable):
    gogoc-1.2-25.fc19.i686
    
    Additional info:
    Note that the scraping has actually been broken since the ifconfig
    format changed in Fedora 17 (and this breakage predicted at the time) —
    see rhbz #784314. However, I suspect the ifconfig command was previously
    more input-tolerant, for instance accepting 'ifconfig tun del
    ip:v6:addr' commands without a prefix length, so the broken scraping was
    still "good enough". This is no longer true in some cases, and anyway it
    makes sense that gogoc handle the current format completely and
    correctly.

 ...output_scraping_to_match_current_ifconfig.patch |   31 ++++++++++++++++++++
 gogoc.spec                                         |    9 +++++-
 2 files changed, 39 insertions(+), 1 deletions(-)
---
diff --git a/gogoc-1.2-bz983052_adjust_output_scraping_to_match_current_ifconfig.patch b/gogoc-1.2-bz983052_adjust_output_scraping_to_match_current_ifconfig.patch
new file mode 100644
index 0000000..a5c2453
--- /dev/null
+++ b/gogoc-1.2-bz983052_adjust_output_scraping_to_match_current_ifconfig.patch
@@ -0,0 +1,31 @@
+diff --git a/gogoc-tsp/template/linux.sh b/gogoc-tsp/template/linux.sh
+index e7ba487..0112eb4 100644
+--- a/gogoc-tsp/template/linux.sh
++++ b/gogoc-tsp/template/linux.sh
+@@ -159,7 +159,7 @@ if [ X"${TSP_OPERATION}" = X"TSP_TUNNEL_TEARDOWN" ]; then
+ 
+       Delete interface IPv6 configuration.
+       PREF=`echo $TSP_CLIENT_ADDRESS_IPV6 | sed "s/:0*/:/g" |cut -d : -f1-2`
+-      OLDADDR=`$ifconfig $TSP_TUNNEL_INTERFACE | grep "inet6.* $PREF" | sed -e "s/^.*inet6 addr: //" -e "s/ Scope.*\$//"`
++      OLDADDR=`$ifconfig $TSP_TUNNEL_INTERFACE | grep "inet6.* $PREF" | sed -e "s/^.*inet6 //" -e "s/  prefixlen /\//" -e "s/  scope.*\$//"`
+       if [ ! -z $OLDADDR ]; then
+         ExecNoCheck $ifconfig $TSP_TUNNEL_INTERFACE inet6 del $OLDADDR
+       fi
+@@ -198,7 +198,7 @@ if [ X"${TSP_HOST_TYPE}" = X"host" ] || [ X"${TSP_HOST_TYPE}" = X"router" ]; the
+ 
+    # Clean-up old interface IPv6 configuration.
+    PREF=`echo $TSP_CLIENT_ADDRESS_IPV6 | sed "s/:0*/:/g" |cut -d : -f1-2`
+-   OLDADDR=`$ifconfig $TSP_TUNNEL_INTERFACE | grep "inet6.* $PREF" | sed -e "s/^.*inet6 addr: //" -e "s/ Scope.*\$//"`
++   OLDADDR=`$ifconfig $TSP_TUNNEL_INTERFACE | grep "inet6.* $PREF" | sed -e "s/^.*inet6 //" -e "s/  prefixlen /\//" -e "s/  scope.*\$//"`
+    if [ ! -z $OLDADDR ]; then
+       Display 1 "Removing old IPv6 address $OLDADDR"
+       Exec $ifconfig $TSP_TUNNEL_INTERFACE inet6 del $OLDADDR
+@@ -241,7 +241,7 @@ if [ X"${TSP_HOST_TYPE}" = X"router" ]; then
+    fi
+ 
+    # Add prefix::1 on advertising interface. Clean up before.
+-   OLDADDR=`$ifconfig $TSP_HOME_INTERFACE | grep "inet6.* $PREF" | sed -e "s/^.*inet6 addr: //" -e "s/ Scope.*\$//"`
++   OLDADDR=`$ifconfig $TSP_HOME_INTERFACE | grep "inet6.* $PREF" | sed -e "s/^.*inet6 //" -e "s/  prefixlen /\//" -e "s/  scope.*\$//"`
+    if [ ! -z $OLDADDR ]; then
+       Display 1 "Removing old IPv6 address $OLDADDR"
+       Exec $ifconfig $TSP_HOME_INTERFACE inet6 del $OLDADDR
diff --git a/gogoc.spec b/gogoc.spec
index ae1c126..b8ffc2c 100644
--- a/gogoc.spec
+++ b/gogoc.spec
@@ -3,7 +3,7 @@
 
 Name:           gogoc
 Version:        1.2
-Release:        25%{?dist}
+Release:        26%{?dist}
 Summary:        IPv6 TSP client for gogo6
 
 Group:          System Environment/Daemons
@@ -21,6 +21,8 @@ Patch4:         %{name}-%{version}-lp418176_client_v4.patch
 Patch5:         %{name}-%{version}-selinux_fix.patch
 Patch6:         %{name}-%{version}-kill_radvd.patch
 Patch7:         %{name}-%{version}-debug_info.patch
+# Patch8: https://bugzilla.redhat.com/show_bug.cgi?id=983052
+Patch8:         %{name}-%{version}-bz983052_adjust_output_scraping_to_match_current_ifconfig.patch
 
 BuildRequires:  openssl-devel
 BuildRequires:  systemd-units
@@ -50,6 +52,7 @@ you need an account in Freenet6 http://gogonet.gogo6.com/page/freenet6-account
 %patch5 -p1 -b .selinux_fix
 %patch6 -p1 -b .kill_radvd
 %patch7 -p1
+%patch8 -p1
 
 %build
 CFLAGS="%{optflags}"; export CFLAGS
@@ -116,6 +119,10 @@ fi
 %{_unitdir}/%{name}.service
 
 %changelog
+* Fri Jul 12 2013 Juan Orti Alcaine <jorti at fedoraproject.org> - 1.2-26
+- Adjust output scraping to match current ifconfig. Closes bug #983052,
+  thanks to Frank Dana
+
 * Tue May 28 2013 Juan Orti Alcaine <jorti at fedoraproject.org> - 1.2-25
 - Add startup options via environment variable in service unit file
 


More information about the scm-commits mailing list