Menu

Code for a wrtp54g

Help
kojak2
2005-08-27
2013-01-14
  • kojak2

    kojak2 - 2005-08-27

    Just wanted to put this out there for the maintainers of ddclient.  I had to tweak it to get it to work with a linksys wrtp54g.  I'm no perl guru and I wasn't sure how to use the low level socket stuff in the ddclient executable so I had to download a bunch of modules to get my hack to work.  Maybe you guys can figure out a proper way to hook it into ddclient.

    <code>
    # Included these modules
    use LWP::UserAgent;
    use HTML::TokeParser::Simple;

    # Changed the lines in get_ip()
    if ($url) {
            # OLD STUFF
            # $reply = geturl('', $url, opt('fw-login'), opt('fw-password')) || '';
        # OLD STUFF
       
            # NEW STUFF
        my $LOGIN_PAGE = "http://192.168.1.1/cgi-bin/webcm";
            my $STATUS_PAGE = "http://192.168.1.1/cgi-bin/webcm?getpage=/usr/www_safe/html/status/Router.html";
            my $POST_CONTENT = "security%3Acommand%2Flogout=&getpage=%2Fusr%2Fwww_safe%2Fhtml%2Fhome.html&errorpage=%2Fusr%2Fwww_safe%2Findex.html&var%3Apagename=home&login%3Acommand%2Fusername_ja=" . opt('fw-login') . "&login%3Acommand%2Fpassword_ja=" . opt('fw-password') . "&var%3Arequestfrom=";

            # Create the user agent object
            my $ua = LWP::UserAgent->new;

            # POST to Login
            my $request = HTTP::Request->new(POST => $LOGIN_PAGE);
            $request->content_type('application/x-www-form-urlencoded');
            $request->content($POST_CONTENT);
            my $response = $ua->request($request);
            if ($response->is_success) {
                    $request = HTTP::Request->new("GET");
                    $request->url($STATUS_PAGE);
                    $response = $ua->request($request);
                    if ($response->is_success) {
                            $reply = $response->content;
                    }
            }
            # NEW STUFF
    }
    </code>

     
    • wimpunk

      wimpunk - 2005-08-27

      Hm, looks like a relative good job, but it will be a little harder for us to code it into ddclient so that the other routers still work.
      Anyway, could you also post the firmware version of your linksys?  And I'm a little curious: isn't there a dyndns-client builtin?

       
    • kojak2

      kojak2 - 2005-08-27

      Firmware Version: 1.00.43

      There is a built-in dyndns-client but it can't do all of the stuff that ddclient can do all of the stuff that ddclient can do (e.g. multiple top level domains and mail server).

      Cheers

       
    • kojak2

      kojak2 - 2005-08-27

      BTW: The string to search for on the wrtp54g status page is:
        "Internet IP Address:"

       
    • NilRake

      NilRake - 2005-09-27

      This looks a lot like my new vonage linksys rtp300. The only change, based on debian sarge v3.6.2-3.1 was to add a new "router" section as follows:

      'rtp300'                 => {
      'name' => 'Linksys RTP300',
      'url'  => '/cgi-bin/webcm?getpage=%2Fusr%2Fwww_safe%2Fhtml%2Fstatus%2FRouter.html',
        'skip' => 'Internet.*?IP Address',
      },

      Then I just changed my /etc/ddclient.conf to 'use=rtp300'

      Worked first time.

       
    • Y Def

      Y Def - 2006-02-04

      I just noticed this code available for the wrtp54g.

      How is it supposed to work with ddclient?  It looks like a seperate module, is it not supposed to be added into the 'builtinfw' part of the ddclient code or as an independent module?

       
    • Y Def

      Y Def - 2006-02-04

      I tried inserting the replacement code in the get_ip() function and adding the two perl libs tot he latest ddclient without luck.

       
    • Y Def

      Y Def - 2006-02-04

      My errors seem to be with these variables:
      [1:01AM]root@radio(3):/opt/cvs/repository/ddclient-3.6.7:# ddclient -daemon=0 -query -debug -verbose -noquiet
      Global symbol "$LOGIN_PAGE" requires explicit package name at /usr/local/sbin/ddclient line 1686.
      Global symbol "$POST_CONTENT" requires explicit package name at /usr/local/sbin/ddclient line 1688.
      Global symbol "$STATUS_PAGE" requires explicit package name at /usr/local/sbin/ddclient line 1692.

       
      • wimpunk

        wimpunk - 2006-02-04

        It normally just works out of the box, at least if your configuration is correct.  I would suggest to first try to get it working with "use=web" (so _not_ using the linksys code).  When this works, try use=linksys-wrt854g

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.