]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
Upnp fast fertig gestellt zumindest was Web
authormaniacikarus <maniacikarus@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Thu, 29 Mar 2007 19:50:28 +0000 (19:50 +0000)
committermaniacikarus <maniacikarus@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Thu, 29 Mar 2007 19:50:28 +0000 (19:50 +0000)
und Ctrl Datei angeht

git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@472 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

config/upnp/gatedesc.xml [new file with mode: 0755]
html/cgi-bin/upnp.cgi
lfs/linux-igd
src/misc-progs/upnpctrl.c

diff --git a/config/upnp/gatedesc.xml b/config/upnp/gatedesc.xml
new file mode 100755 (executable)
index 0000000..49d2406
--- /dev/null
@@ -0,0 +1,81 @@
+<?xml version="1.0"?>
+<root xmlns="urn:schemas-upnp-org:device-1-0">
+       <specVersion>
+               <major>1</major>
+               <minor>0</minor>
+       </specVersion>
+       <device>
+               <deviceType>urn:schemas-upnp-org:device:InternetGatewayDevice:1</deviceType>
+               <friendlyName>IpFire Upnp Device</friendlyName>
+               <manufacturer>IpFire Project</manufacturer>
+               <manufacturerURL>http://www.ipfire.org</manufacturerURL>
+               <modelName>IGD Version 0.92</modelName>
+               <UDN>uuid:75802409-bccb-40e7-8e6c-fa095ecce13e</UDN>
+               <iconList>
+                       <icon>
+                               <mimetype>image/gif</mimetype>
+                               <width>118</width>
+                               <height>119</height>
+                               <depth>8</depth>
+                               <url>/ligd.gif</url>
+                       </icon>
+               </iconList>
+               <serviceList>
+                        <service>
+                                <serviceType>urn:schemas-dummy-com:service:Dummy:1</serviceType>
+                                <serviceId>urn:dummy-com:serviceId:dummy1</serviceId>
+                               <controlURL>/dummy</controlURL>
+                                <eventSubURL>/dummy</eventSubURL>
+                                       <SCPDURL>/dummy.xml</SCPDURL>
+                        </service>
+                </serviceList>
+               <deviceList>
+                       <device>
+                               <deviceType>urn:schemas-upnp-org:device:WANDevice:1</deviceType>
+                               <friendlyName>WANDevice</friendlyName>
+                               <manufacturer>IpFire Project</manufacturer>
+                               <manufacturerURL>http://www.ipfire.org</manufacturerURL>
+                               <modelDescription>WAN Device on Linux IGD</modelDescription>
+                               <modelName>Linux IGD</modelName>
+                               <modelNumber>0.92</modelNumber>
+                               <modelURL>http://linux-igd.sourceforge.net</modelURL>
+                               <serialNumber>0.92</serialNumber>
+                               <UDN>uuid:75802409-bccb-40e7-8e6c-fa095ecce13e</UDN>
+                               <UPC>Linux IGD</UPC>
+                               <serviceList>
+                                       <service>
+                                               <serviceType>urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1</serviceType>
+                                               <serviceId>urn:upnp-org:serviceId:WANCommonIFC1</serviceId>
+                                               <controlURL>/upnp/control/WANCommonIFC1</controlURL>
+                                               <eventSubURL>/upnp/control/WANCommonIFC1</eventSubURL>
+                                               <SCPDURL>/gateicfgSCPD.xml</SCPDURL>
+                                       </service>
+                               </serviceList>
+                               <deviceList>
+                                       <device>
+                                               <deviceType>urn:schemas-upnp-org:device:WANConnectionDevice:1</deviceType>
+                                               <friendlyName>WANConnectionDevice</friendlyName>
+                                               <manufacturer>IpFire Project</manufacturer>
+                                               <manufacturerURL>http://www.ipfire.org</manufacturerURL>
+                                               <modelDescription>WanConnectionDevice on Linux IGD</modelDescription>
+                                               <modelName>Linux IGD</modelName>
+                                               <modelNumber>0.92</modelNumber>
+                                               <modelURL>http://www.ipfire.org</modelURL>
+                                               <serialNumber>0.92</serialNumber>
+                                               <UDN>uuid:75802409-bccb-40e7-8e6c-fa095ecce13e</UDN>
+                                               <UPC>Linux IGD</UPC>
+                                               <serviceList>
+                                                       <service>
+                                                               <serviceType>urn:schemas-upnp-org:service:WANIPConnection:1</serviceType>
+                                                               <serviceId>urn:upnp-org:serviceId:WANIPConn1</serviceId>
+                                                               <controlURL>/upnp/control/WANIPConn1</controlURL>
+                                                               <eventSubURL>/upnp/control/WANIPConn1</eventSubURL>
+                                                               <SCPDURL>/gateconnSCPD.xml</SCPDURL>
+                                                       </service>
+                                               </serviceList>
+                                       </device>
+                               </deviceList>
+                       </device>
+               </deviceList>
+       </device>
+</root>
index 3970cc8d927075d4dd48e24be7e3f5f89ce642c0..3d8495501cd0c7b93f214668f3b705b56d494f95 100644 (file)
@@ -17,17 +17,12 @@ require "${General::swroot}/lang.pl";
 require "${General::swroot}/header.pl";
 
 my %upnpsettings = ();
-my %checked = ();
 my %netsettings = ();
 my $message = "";
 my $errormessage = "";
 my %selected= () ;
-&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
 
-my %servicenames =
-(
-        'UPnP Daemon' => 'upnpd',
-);
+my %servicenames =('UPnP Daemon' => 'upnpd',);
 
 &Header::showhttpheaders();
 ############################################################################################################################
@@ -35,25 +30,17 @@ my %servicenames =
 
 $upnpsettings{'DEBUGMODE'} = '3';
 $upnpsettings{'FORWARDRULES'} = 'yes';
-$upnpsettings{'FORWARDCHAIN'} = 'FORWARD';
-$upnpsettings{'PREROUTINGCHAIN'} = 'PORTFW';
 $upnpsettings{'DOWNSTREAM'} = '900000';
 $upnpsettings{'UPSTREAM'} = '16000000';
 $upnpsettings{'DESCRIPTION'} = 'gatedesc.xml';
 $upnpsettings{'XML'} = '/etc/linuxigd';
 $upnpsettings{'ENABLED'} = 'off';
-$upnpsettings{'GREENi'} = 'on';
-$upnpsettings{'BLUEi'} = 'off';
-$upnpsettings{'REDi'} = 'off';
-$upnpsettings{'ORANGEi'} = 'off';
-$upnpsettings{'GREENe'} = 'off';
-$upnpsettings{'BLUEe'} = 'off';
-$upnpsettings{'REDe'} = 'on';
-$upnpsettings{'ORANGEe'} = 'off';
+$upnpsettings{'friendlyName'} = 'IpFire Upnp Device';
 ### Values that have to be initialized
 $upnpsettings{'ACTION'} = '';
 
 &General::readhash("${General::swroot}/upnp/settings", \%upnpsettings);
+&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
 &Header::getcgihash(\%upnpsettings);
 
 &Header::openpage('UPnP', 1, '');
@@ -63,20 +50,22 @@ $upnpsettings{'ACTION'} = '';
 ################################################### Speichern der Config ###################################################
 
 if ($upnpsettings{'ACTION'} eq $Lang::tr{'save'})
-{
-&General::writehash("${General::swroot}/upnp/settings", \%upnpsettings);
+       {
+       $upnpsettings{'DOWNSTREAM'} = $upnpsettings{'DOWNSTREAM'} * 8;
+       $upnpsettings{'UPSTREAM'} = $upnpsettings{'UPSTREAM'} * 8;
+       &General::writehash("${General::swroot}/upnp/settings", \%upnpsettings);
 
        open (FILE, ">${General::swroot}/upnp/upnpd.conf") or die "Can't save the upnp config: $!";
        flock (FILE, 2);
-       
-print FILE <<END
+
+       print FILE <<END
 
 # UPnP Config by Ipfire Project
 
 debug_mode = $upnpsettings{'DEBUGMODE'}
 insert_forward_rules = $upnpsettings{'FORWARDRULES'}
-forward_chain_name = $upnpsettings{'FORWARDCHAIN'}
-prerouting_chain_name = $upnpsettings{'PREROUTINGCHAIN'}
+forward_chain_name = FORWARD
+prerouting_chain_name = PORTFW
 upstream_bitrate = $upnpsettings{'DOWNSTREAM'}
 downstream_bitrate = $upnpsettings{'UPSTREAM'}
 description_document_name = $upnpsettings{'DESCRIPTION'}
@@ -84,161 +73,93 @@ xml_document_path = $upnpsettings{'XML'}
 
 END
 ;
-close FILE;
-}
+       close FILE;
+       system("/usr/local/bin/upnpctrl upnpxml $upnpsettings{'XML'} $upnpsettings{'DESCRIPTION'} $upnpsettings{'manufacturer'}");
+       }
 elsif ($upnpsettings{'ACTION'} eq 'Start')
-{
-        $upnpsettings{'ENABLED'} = 'on';
-        &General::writehash("${General::swroot}/upnp/settings", \%upnpsettings);
-        system("/usr/local/bin/upnpctrl upnpdstart $netsettings{'RED_DEV'} $netsettings{'GREEN_DEV'}");
-} 
+       {
+       $upnpsettings{'ENABLED'} = 'on';
+       &General::writehash("${General::swroot}/upnp/settings", \%upnpsettings);
+       system("/usr/local/bin/upnpctrl upnpdstart $netsettings{'RED_DEV'} $netsettings{'GREEN_DEV'}");
+       
 elsif ($upnpsettings{'ACTION'} eq 'Stop')
-{
-        $upnpsettings{'ENABLED'} = 'off';
-        &General::writehash("${General::swroot}/upnp/settings", \%upnpsettings);
-        system("/usr/local/bin/upnpctrl stop");
-} 
+       {
+       $upnpsettings{'ENABLED'} = 'off';
+       &General::writehash("${General::swroot}/upnp/settings", \%upnpsettings);
+       system("/usr/local/bin/upnpctrl stop");
+       
 elsif ($upnpsettings{'ACTION'} eq $Lang::tr{'restart'})
-{
-        &General::writehash("${General::swroot}/upnp/settings", \%upnpsettings);
-        system("/usr/local/bin/upnpctrl stop");
-        system("/usr/local/bin/upnpctrl start $netsettings{'RED_DEV'} $netsettings{'GREEN_DEV'}");
-}
+       {
+       &General::writehash("${General::swroot}/upnp/settings", \%upnpsettings);
+       system("/usr/local/bin/upnpctrl stop");
+       system("/usr/local/bin/upnpctrl start $netsettings{'RED_DEV'} $netsettings{'GREEN_DEV'}");
+       }
 
 &General::readhash("${General::swroot}/upnp/settings", \%upnpsettings);
+$upnpsettings{'DOWNSTREAM'} = $upnpsettings{'DOWNSTREAM'} / 8;
+$upnpsettings{'UPSTREAM'} = $upnpsettings{'UPSTREAM'} / 8;
 
-if ($errormessage) {
-        &Header::openbox('100%', 'left', $Lang::tr{'error messages'});
-        print "<class name='base'>$errormessage\n";
-        print "&nbsp;</class>\n";
-        &Header::closebox();
-}
-
-$checked{'GREENi'}{'on'} = '';
-$checked{'GREENi'}{'off'} = '';
-$checked{'GREENi'}{"$upnpsettings{'GREENi'}"} = 'checked';
-$checked{'BLUEi'}{'on'} = '';
-$checked{'BLUEi'}{'off'} = '';
-$checked{'BLUEi'}{"$upnpsettings{'BLUEi'}"} = 'checked';
-$checked{'REDi'}{'on'} = '';
-$checked{'REDi'}{'off'} = '';
-$checked{'REDi'}{"$upnpsettings{'REDi'}"} = 'checked';
-$checked{'ORANGEi'}{'on'} = '';
-$checked{'ORANGEi'}{'off'} = '';
-$checked{'ORANGEi'}{"$upnpsettings{'ORANGEi'}"} = 'checked';
-$checked{'GREENe'}{'on'} = '';
-$checked{'GREENe'}{'off'} = '';
-$checked{'GREENe'}{"$upnpsettings{'GREENe'}"} = 'checked';
-$checked{'BLUEe'}{'on'} = '';
-$checked{'BLUEe'}{'off'} = '';
-$checked{'BLUEe'}{"$upnpsettings{'BLUEe'}"} = 'checked';
-$checked{'REDe'}{'on'} = '';
-$checked{'REDe'}{'off'} = '';
-$checked{'REDe'}{"$upnpsettings{'REDe'}"} = 'checked';
-$checked{'ORANGEe'}{'on'} = '';
-$checked{'ORANGEe'}{'off'} = '';
-$checked{'ORANGEe'}{"$upnpsettings{'ORANGEe'}"} = 'checked';
+if ($errormessage)
+       {
+       &Header::openbox('100%', 'left', $Lang::tr{'error messages'});
+       print "<class name='base'>$errormessage\n";
+       print "&nbsp;</class>\n";
+       &Header::closebox();
+       }
 
 ############################################################################################################################
 ############################################################################################################################
 
 &Header::openbox('100%', 'center', 'UPnP');
 print <<END
-        <form method='post' action='$ENV{'SCRIPT_NAME'}'>
-        <table width='95%' cellspacing='0'>
+<form method='post' action='$ENV{'SCRIPT_NAME'}'>
+<table width='95%' cellspacing='0'>
 END
 ;
-        if ( $message ne "" ) {
-                print "<tr><td colspan='3' align='center'><font color='red'>$message</font>";
-        }
+if ( $message ne "" ) {print "<tr><td colspan='3' align='center'><font color='red'>$message</font>";}
+
+my $lines = 0;
+my $key = '';
+foreach $key (sort keys %servicenames)
+{
+       if ($lines % 2)
+               {print "<tr bgcolor='${Header::table1colour}'>\n";}
+       else
+               {print "<tr bgcolor='${Header::table2colour}'>\n"; }
+
+       print "<td align='left'>$key\n";
+       my $shortname = $servicenames{$key};
+       my $status = &isrunning($shortname);
+       print "$status\n";
+       $lines++;
+}
 
-        my $lines = 0;
-        my $key = '';
-        foreach $key (sort keys %servicenames)
-        {
-                if ($lines % 2) {
-                        print "<tr bgcolor='${Header::table1colour}'>\n"; }
-                else {
-                        print "<tr bgcolor='${Header::table2colour}'>\n"; }
-                print "<td align='left'>$key\n";
-                my $shortname = $servicenames{$key};
-                my $status = &isrunning($shortname);
-                print "$status\n";
-                $lines++;
-        }
-        print <<END
-                <tr><td><b>Alle Dienste:</b></td><td colspan='2'>
-                <input type='submit' name='ACTION' value='Start' /> 
-                <input type='submit' name='ACTION' value='Stop' /> 
-                <input type='submit' name='ACTION' value='$Lang::tr{'restart'}' />
-        </table>
-END
-;
-#print <<END
-#        <br></br>
-#        <hr />
-#        <br></br>
-#        
-#        <table width='95%'>
-#        <tr><td colspan='2' align='left' bgcolor='${Header::table1colour}'><b>External Interface</b></td></tr>
-#        <tr><td align='left'>&nbsp;</td><td><input type='radio' name='External' value='$netsettings{'RED_DEV'}' $checked{'REDe'}{'on'}><font size='2' color='$Header::colourred'><b>RED - $netsettings{'RED_DEV'}</b></font><br></br>
-#                                            <input type='radio' name='External' value='$netsettings{'GREEN_DEV'}' $checked{'GREENe'}{'on'}><font size='2' color='$Header::colourgreen'><b>$Lang::tr{'green'} - $netsettings{'GREEN_DEV'}</b></font><br></br>
-#END
-#;
-#         if (&Header::blue_used()){
-#         print <<END
-#                                             <input type='radio' name='External' value='$netsettings{'BLUE_DEV'}' $checked{'BLUEe'}{'on'}><font size='2' color='$Header::colourblue'><b>$Lang::tr{'wireless'} - $netsettings{'BLUE_DEV'}</b></font><br></br>
-#END
-#;
-#                                    }
-#         if (&Header::orange_used()){
-#         print <<END
-#                                             <input type='radio' name='External' value='$netsettings{'ORANGE_DEV'}' $checked{'ORANGEe'}{'on'}><font size='2' color='$Header::colourorange'><b>$Lang::tr{'dmz'} - $netsettings{'ORANGE_DEV'}</b></font><br></br>
-#END
-#;
-#                                    }
-#        print <<END
-#        </td></tr>
-#        <tr><td colspan='2' align='left'><br></br></td></tr>
-#        <tr><td colspan='2' align='left' bgcolor='${Header::table1colour}'><b>Internal Interface</b></td></tr>
-#        <tr><td align='left'>&nbsp;</td><td><input type='radio' name='Internal' value='$netsettings{'RED_DEV'}' $checked{'REDi'}{'on'}><font size='2' color='$Header::colourred'><b>RED - $netsettings{'RED_DEV'}</b></font><br></br>
-#                                            <input type='radio' name='Internal' value='$netsettings{'GREEN_DEV'}' $checked{'GREENi'}{'on'}><font size='2' color='$Header::colourgreen'><b>$Lang::tr{'green'} - $netsettings{'GREEN_DEV'}</b></font><br></br>
-#END
-#;
-#         if (&Header::blue_used()){
-#         print <<END
-#                                            <input type='radio' name='Internal' value='$netsettings{'BLUE_DEV'}' $checked{'BLUEi'}{'on'}><font size='2' color='$Header::colourblue'><b>$Lang::tr{'wireless'} - $netsettings{'BLUE_DEV'}</b></font><br></br>
-#END
-#;
-#                                    }
-#         if (&Header::orange_used()){
-#         print <<END
-#                                            <input type='radio' name='Internal' value='$netsettings{'ORANGE_DEV'}' $checked{'ORANGEi'}{'on'}><font size='2' color='$Header::colourorange'><b>$Lang::tr{'dmz'} - $netsettings{'ORANGE_DEV'}</b></font><br></br>
-#END
-#;
-#                                    }
-#        print <<END
-#        </td></tr></table>
 print <<END
+<tr><td align='left'>Alle Dienste:</td><td align='center' colspan='2'>
+<input type='submit' name='ACTION' value='Start' /> 
+<input type='submit' name='ACTION' value='Stop' /> 
+<input type='submit' name='ACTION' value='$Lang::tr{'restart'}' />
+</table>
 </form>
-<br></br>
+<br />
 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
 <table width='95%' cellspacing='0'>
 <tr><td colspan='2' align='left' bgcolor='${Header::table1colour}'><b>$Lang::tr{'options'}</b></td></tr>
 <tr><td colspan='2' align='left'><br></br></td></tr>
-<tr><td align='left'>Debug Mode:</td><td><input type='text' name='DEBUGMODE' value='$upnpsettings{'DEBUGMODE'}' size="30"></input></td></tr>
-<tr><td align='left'>Forward Rules:</td><td><input type='text' name='FORWARDRULES' value='$upnpsettings{'FORWARDRULES'}' size="30"></input></td></tr>
-<tr><td align='left'>Forward Chain:</td><td><input type='text' name='FORWARDCHAIN' value='$upnpsettings{'FORWARDCHAIN'}' size="30"></input></td></tr>
-<tr><td align='left'>Prerouting Chain:</td><td><input type='text' name='PREROUTINGCHAIN' value='$upnpsettings{'PREROUTINGCHAIN'}' size="30"></input></td></tr>
-<tr><td align='left'>Down Stream:</td><td><input type='text' name='DOWNSTREAM' value='$upnpsettings{'DOWNSTREAM'}' size="30"></input></td></tr>
-<tr><td align='left'>Up Strean:</td><td><input type='text' name='UPSTREAM' value='$upnpsettings{'UPSTREAM'}' size="30"></input></td></tr>
-<tr><td align='left'>Description Document:</td><td><input type='text' name='DESCRIPTION' value='$upnpsettings{'DESCRIPTION'}' size="30"></input></td></tr>
-<tr><td align='left'>XML Document:</td><td><input type='text' name='XML' value='$upnpsettings{'XML'}' size="30"></input></td></tr>
+<tr><td align='left'>Debug Mode:</td><td><input type='text' name='DEBUGMODE' value='$upnpsettings{'DEBUGMODE'}' size="30" /></td></tr>
+<tr><td align='left'>Forward Rules:</td><td><input type='text' name='FORWARDRULES' value='$upnpsettings{'FORWARDRULES'}' size="30" /></td></tr>
+<tr><td align='left' colspan='2'><br /></td></tr>
+<tr><td align='left'>Down Stream in KB:</td><td><input type='text' name='DOWNSTREAM' value='$upnpsettings{'DOWNSTREAM'}' size="30" /></td></tr>
+<tr><td align='left'>Up Strean in KB:</td><td><input type='text' name='UPSTREAM' value='$upnpsettings{'UPSTREAM'}' size="30" /></td></tr>
+<tr><td align='left' colspan='2'><br /></td></tr>
+<tr><td align='left'>XML Document:</td><td><input type='text' name='XML' value='$upnpsettings{'XML'}' size="30" /></td></tr>
+<tr><td align='left'>Description Document:</td><td><input type='text' name='DESCRIPTION' value='$upnpsettings{'DESCRIPTION'}' size="30" /></td></tr>
+<tr><td align='left'>Upnp Device Name:</td><td><input type='text' name='friendlyName' value='$upnpsettings{'friendlyName'}' size="30" /></td></tr>
 <tr><td colspan='2' align='left'><br></br></td></tr>
 <tr><td colspan='2' align='center'><input type='submit' name='ACTION' value=$Lang::tr{'save'} />
 </table></form>
-<br></br>
-<hr></hr>
+<br />
+<hr />
 END
 ;
 &Header::closebox();
@@ -250,34 +171,29 @@ END
 ############################################################################################################################
 
 sub isrunning
-{
-        my $cmd = $_[0];
-        my $status = "<td bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td>";
-        my $pid = '';
-        my $testcmd = '';
-        my $exename;
-
-        $cmd =~ /(^[a-z]+)/;
-        $exename = $1;
-
-        if (open(FILE, "/var/run/${cmd}.pid"))
-        {
-                $pid = <FILE>; chomp $pid;
-                close FILE;
-                if (open(FILE, "/proc/${pid}/status"))
-                {
-                        while (<FILE>)
-                        {
-                                if (/^Name:\W+(.*)/) {
-                                        $testcmd = $1; }
-                        }
-                        close FILE;
-                        if ($testcmd =~ /$exename/)
-                        {
-                                $status = "<td bgcolor='${Header::colourgreen}'><font color='white'><b>$Lang::tr{'running'}</b></font></td>";
-                        }
-                }
-        }
-
-        return $status;
-}
+       {
+       my $cmd = $_[0];
+       my $status = "<td bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td>";
+       my $pid = '';
+       my $testcmd = '';
+       my $exename;
+
+       $cmd =~ /(^[a-z]+)/;
+       $exename = $1;
+
+       if (open(FILE, "/var/run/${cmd}.pid"))
+               {
+               $pid = <FILE>; chomp $pid;
+               close FILE;
+               if (open(FILE, "/proc/${pid}/status"))
+                       {
+                       while (<FILE>)
+                               {if (/^Name:\W+(.*)/) {$testcmd = $1; }}
+                       close FILE;
+                       if ($testcmd =~ /$exename/)
+                               {$status = "<td bgcolor='${Header::colourgreen}'><font color='white'><b>$Lang::tr{'running'}</b></font></td>";}
+                       }
+               }
+
+               return $status;
+       }
\ No newline at end of file
index 704fa1b4eece59e88445a4a02d68c563eaf62707..ff5dbce425defa5d6ee606ca68d676621ec63d09 100644 (file)
@@ -74,5 +74,6 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
        cd $(DIR_APP) && make $(MAKETUNING) #HAVE_LIBIPTC=1
        cd $(DIR_APP) && make install
+       cp -vf $(DIR_SRC)/config/upnp/* /etc/linuigd/
        @rm -rf $(DIR_APP)
        @$(POSTBUILD)
index d133c163ce05a873cefa03441adcdcba7baab647..bb6c43b3ec93f8d9f13dd3dbec66ea8f5ab9b0e1 100644 (file)
@@ -19,13 +19,13 @@ int main(int argc, char *argv[])
         // Check what command is asked
         if (argc==1)
         {
-            fprintf (stderr, "Missing upnpctrl command!\n");
+            fprintf (stderr, "Missing smbctrl command!\n");
             return 1;
         }
 
-        if (strcmp(argv[1], "start")==0)
+        if (strcmp(argv[1], "upnpstart")==0)
         {
-            snprintf(command, BUFFER_SIZE-1, "route add -net 239.0.0.0 netmask 255.0.0.0 %s", argv[2]);
+            snprintf(command, BUFFER_SIZE-1, "route add -net 239.0.0.0 netmask 255.0.0.0 %s", argv[3]);
             safe_system(command);
             printf(command);
             snprintf(command, BUFFER_SIZE-1, "/usr/sbin/upnpd %s %s", argv[2], argv[3] );
@@ -34,14 +34,21 @@ int main(int argc, char *argv[])
             return 0;
         }
 
-        if (strcmp(argv[1], "stop")==0)
+        if (strcmp(argv[1], "upnpstop")==0)
         {
             snprintf(command, BUFFER_SIZE-1, "killall upnpd");
             safe_system(command);
             printf(command);
-            snprintf(command, BUFFER_SIZE-1, "route del -net 239.0.0.0 netmask 255.0.0.0 %s", argv[2]);
+            snprintf(command, BUFFER_SIZE-1, "route del -net 239.0.0.0 netmask 255.0.0.0 %s", argv[3]);
             safe_system(command);
             printf(command);
             return 0;
         }
-}
+        if (strcmp(argv[1], "upnpxml")==0)
+        {
+            snprintf(command, BUFFER_SIZE-1, "sed 's/<friendlyName>.*<\/friendlyName>/<friendlyName>%s<\/friendlyName>/gi' %s/%s > tmp && mv tmp %s/%s", argv[2], argv[3], argv[4], argv[3], argv[4]);
+            safe_system(command);
+            printf(command);
+            return 0;
+        }
+}
\ No newline at end of file