Don't set MTU on socket
I have spent some time debugging this :) I was trying to use the proxy between a PS4 and a Dual Shock. Everything seemed to be fine, except that after the PS4 sent its "big" SDP packet (797 bytes), nothing happened and the outgoing connection to the PS4 on HID PSMs timed out.
Removing the MTU option fixed this. My guess (I'm no BT expert) is that the PS4 did not like a "fragmented" packet that wasn't actually fragmented (since the MTU was 1024, ace_send_data only had to call writev once). Now everything works fine. This is only a problem the first time the proxy is used with a given BTADDR of course, since subsequent connexions do not trigger the PS4 -> DS SDP stuff.
Thanks for sharing! Is the acl_send_data hack still necessary after removing the MTU option?
Yes it is. On the other hand, removing the acl_send_data hack and setting the MTU doesn't work; write() still errors out with "invalid packet size" or something. So the only combination that works is acl_send_data + default MTU