post action to Linksys router

Steven Yen
2003-08-15
2003-12-15
  • Steven Yen
    Steven Yen
    2003-08-15

    Perhpas this is more appropriate to post the question:

    I just downloaded and am using clink110d.jar (was using
    clink110c.jar)

    I modified the sample CtrlPoint to test out the package.

    When deviceNotifyReceived is invoked due to ssdp:alive
    and the NT is a rootdevice, I would call a method that
    would retrive the embedded device
    (WANConnectionDevice) then retrive the service
    (WANIPConnection). After the WANIPConnection service
    is found, the method would post the
    action "GetExternalIPAddress".

    I have strip down the network to just my PC (running
    XP) and the Linksys (BEFSR41) router.

    Once the action is posted, I find that Linksys become
    not responsive to any subsequent UPnP requests.
    if I issue request to view the xml file (via port 5678,
    used by Linksys) from an IE browser the request would
    fail where as the request would be successful before I
    run the CtrlPoint and post action.

    I repeat the samething using package from Siemens and
    do not see this kind of none responsive result after
    posting action.

    Wondering if it is modification I made that cause this
    problem I ran the sample control point program. Again I
    issue "GetExternalIPAddress", only first time is
    successful and then the samenone responsive result
    occurs.

    To make Linksys responsive again, I need to force the
    Linksys to issue ssdp:byebye by clicking the "Apply"
    button on it's web interface.

    Sorry for the long email, but it puzzles me if it is a
    problem with cyberlink package.

     

    • Anonymous
      2003-09-26

      I had the same problem - I discovered that the ControlRequest.setRequestHost() method was not setting the host and port correctly as specified in the controlURL. In the Linksys implementation of UPnP, the service controlURLs point to different ports, i.e. the baseURL is http://192.168.1.1:5678, but the control url for WANIPConnection is http://192.168.1.1:2468//WANIPConnection. When the wrong port is used, the Linksys router sends back an invalid SOAP envelope and quits responding on the port altogether until it is reset. To fix the issue, I rewrote the ControlRequest.setRequestHost()  as follows, according the the UPnP 1.0.1 spec, and tested against D-LINk, Netgear, Microsoft, and Linksys UPnp enabled routers.

      protected void setRequestHost(Service service)
          {
              String ctrlURL = service.getControlURL();

              // Thanks for Giordano Sassaroli <sassarol@cefriel.it> (05/21/03)
              setURI(ctrlURL, true);

              Device rootDev = service.getRootDevice();

              String urlBaseStr = rootDev.getURLBase();
              String reqHost;
              int reqPort;
              if(HTTP.isAbsoluteURL(ctrlURL)) {
                  reqHost = HTTP.getHost(ctrlURL);
                  reqPort = HTTP.getPort(ctrlURL);

              }  else if (urlBaseStr == null || urlBaseStr.length() <= 0) {
                 reqHost = HTTP.getHost(rootDev.getLocation());
                 reqPort = HTTP.getPort(rootDev.getLocation());

              } else {
                  reqHost = HTTP.getHost(urlBaseStr);
                  reqPort = HTTP.getPort(urlBaseStr);
              }

              setHost(reqHost, reqPort);
              setRequestHost(reqHost);
              setRequestPort(reqPort);
          }
      }

       
    • Steven Yen
      Steven Yen
      2003-10-01

      I posted my version of the fix before 1.1e release is out.
      I think it is included in the 1.1e release, However, I have not had the time to check out 1.1e yet.
      Did you see this problem using 1.1e release?

       

    • Anonymous
      2003-10-13

      Yes, I observed this behavior in 1.1e. Where did you post your version of the fix?

       

    • Anonymous
      2003-10-22

      I think I found your code in Serivce.java starting on line 278 - but I think I discovered one small error - shouldn't the line be:
      if (urlBaseStr == null || urlBaseStr.length() <= 0)
      rather than
      if (urlBaseStr == null || urlBaseStr.length() < 0) ?

      I was having problems with a Microsoft broadband router before I changed that line.

       
    • Steven Yen
      Steven Yen
      2003-12-05

      It's kind of late, but if you like I will email you with my local copy of the fix that works with Linksys.

       
    • Satoshi Konno
      Satoshi Konno
      2003-12-15

      I don't find the forum message, I am sorry.

      I fixed the bug, I will release the latest package as soon as possible.

       
    • Satoshi Konno
      Satoshi Konno
      2003-12-15

      I uploaded the fixed package as v1.2. Please check it :-)

       
    • Satoshi Konno
      Satoshi Konno
      2003-12-15

      I fixed the followig bug and release the package as v1.2. Please check it:

      >I think I found your code in Serivce.java starting >on line 278 - but I think I discovered one small >error - shouldn't the line be:
      >if (urlBaseStr == null || urlBaseStr.length() <= 0)
      >rather than
      >if (urlBaseStr == null || urlBaseStr.length() < 0)