Beta support: MMS on chatty/mmsd on Modem Manager - help/testing wanted!
#28
(01-04-2021, 01:00 PM)kop316 Wrote: That is right! so what you may need to do (I have had to do this for experiementing) is delete both the .mms/ and mms/ folder in your home folder. That usually cleans up those errors.

Please let me know what you did for getting the proxy!

I put a little hack to do_request() in mmsd/gweb/gweb.c. At ~line 1310, I inserted this:
Code:
.
.
        if (session->address == NULL)
            session->address = g_strdup(session->host);        

        /* Hack to prevent failure if proxy passed as text host name in */
        /* session->address when a numeric IP is needed in this routine */
        struct in_addr *inp; // dummy var for return
        if(inet_aton(session->address,inp) == 0){
            char *hostip;
            struct hostent *hp;
            debug(web,"session->address:%s not numeric ... trying to resolve host ...",session->address);
            hp = gethostbyname(session->address);
            if(hp==NULL){
                debug(web,"Address host look-up failed.");
                free_session(session);
                return 0;
            } else {            
                hostip = inet_ntoa( *(struct in_addr*)(hp->h_addr_list[0]));
                debug(web,"Ip lookup: %s / %s",session->address,hostip);
                session->address = hostip;
                debug(web,"New session->address:%s",session->address);
            }
        }
        /* end hack */
        
        memset(&hints, 0, sizeof(struct addrinfo));
        hints.ai_flags = AI_NUMERICHOST;
.
.

The code immediately following this populates session->addr with an addrinfo structure produced from session->address. The AI_NUMERICHOST flag requires session->address to be a numeric ip address, but whatever logic initially sets up the proxy session assigns the proxy string as provided in simple.c. So proxy would only work if the proxy host was specified as an ip address in simple.c.

My fix checks to see if session->address is in proper IP address format and if not, performs a hostname lookup and replaces the host name with the returned ip address. It works, but I don't really like the solution. If the input specifically *needs* to be a numeric ip address to correctly populate session->addr, the lookup should probably happen where the proxy information is assigned to session->address just like a non-proxy request.

If there *isn't* a specific reason the input needs to be a numeric address here, as best I can tell my fix is functionally redundant to simply commenting out the "hints.ai_flags = AI_NUMERICHOST;" line which would allow the getaddrinfo() call to resolve for either an ip address or text host name. Which, obviously, is a much cleaner solution.

Commenting out the flag did work to get mmsd talking to the proxy, but I'm not sure if changing the way that call works will break something for a different part of the system.
  Reply


Messages In This Thread
RE: Experimental support MMS on chatty - help/testing wanted! - by kent - 01-04-2021, 04:27 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  What File Manager Options Are There For The Pinephone? pinephoneuser22 7 2,604 10-18-2023, 08:37 AM
Last Post: luppivega
  A/B testing or Unit testing gulshan212 0 1,001 08-29-2023, 03:36 AM
Last Post: gulshan212
  Article: NuttX RTOS for PinePhone: 4G LTE Modem lupyuen 2 1,620 04-10-2023, 10:19 PM
Last Post: lupyuen
  changing from bullseye to bookworm to install mmsd-tng jyoung 8 3,085 04-09-2023, 06:08 PM
Last Post: zetabeta
Sad Modem is always visible/connected but stops working after a while dante404 6 3,212 11-08-2022, 09:12 AM
Last Post: dante404
  Downsides of the open-source modem firmware? alpineduck 4 2,705 10-25-2022, 05:28 PM
Last Post: Zebulon Walton
  Pinephone: OpenGL support? orbital 2 2,266 08-25-2022, 04:09 PM
Last Post: vortex
  Latest firmware for PinePhone modem! Subsentient 104 131,073 07-20-2022, 05:32 AM
Last Post: zetabeta
  Which PP OS currently has the best podcast support? kujo_marble 3 2,130 07-14-2022, 07:09 AM
Last Post: tophneal
  Help wanted: location of calls and chatty data files dukla2000 3 4,717 06-13-2022, 02:01 PM
Last Post: israel

Forum Jump:


Users browsing this thread: 4 Guest(s)