Beta support: MMS on chatty/mmsd on Modem Manager - help/testing wanted!
#30
(01-04-2021, 04:27 PM)kent Wrote:
(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.


So I altered the simple.c plugin a bit to allow for a config file. Is there any change you could backport the changes you did in gweb.c and impliment it in simple.c? that way the proxy passed into the bearer is now the IP address and there does not have to be a change in the core code.

EDIT: Actually, on second thought, it looks like proxy is set in this function: g_web_set_proxy() . It may make more sense to put that logic there.

EDIT 2: It looks like the proxy is parsed in parse_url. How did you set the proxy? I am wondering if you may need to set it as "http://proxy.mobile.att.net" vs "proxy.mobile.att.net" or something similar like that. It may be worth playing with it a bit to see if your code is even necessary and it may be some sort of parsing error in parse_url() ?
  Reply


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

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

Forum Jump:


Users browsing this thread: 38 Guest(s)