Commit MetaInfo

Revision2fb6ad37fccb27d02c6f5f8f57856ac82e9c7509 (tree)
Time2017-01-05 11:47:45
AuthorSatoshi Yasuda <jk1zrw@user...>
CommiterSatoshi Yasuda

Log Message

modified: upnp.c

Change Summary

Incremental Difference

--- a/upnp.c
+++ b/upnp.c
@@ -38,12 +38,12 @@ char upnp_urn[128];
3838
3939 void send_msearch_gateway(void)
4040 {
41- char upnp_msg_gateway[137] =
41+ char upnp_msg_gateway[138] =
4242 {"M-SEARCH * HTTP/1.1\r\n" \
4343 "HOST: 239.255.255.250:1900\r\n" \
4444 "ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\n" \
4545 "MAN: \"ssdp:discover\"\r\n" \
46- "MX: 2\r\n\r\n"
46+ "MX: 2\r\n\r\n\0"
4747 };
4848
4949 time(&cur_time);
@@ -686,9 +686,7 @@ void send_upnp_port_add(void)
686686 length = strlen(buf);
687687 memcpy (&buf[length], "<NewRemoteHost></NewRemoteHost>\r\n", 33);
688688 length += 33;
689- memcpy (&buf[length], "<NewExternalPort>40000</NewExternalPort>\r\n", 42);
690- length += 42;
691- sprintf (&buf[length], "<m:AddPortMapping xmlns:m=\"%s\">\r\n", upnp_urn);
689+ sprintf (&buf[length], "<NewExternalPort>%d</NewExternalPort>\r\n", gateway_port);
692690 length = strlen(buf);
693691 memcpy (&buf[length], "<NewProtocol>UDP</NewProtocol>\r\n", 32);
694692 length += 32;
@@ -751,8 +749,8 @@ void send_upnp_port_del(void)
751749 length = strlen(buf);
752750 memcpy (&buf[length], "<NewRemoteHost></NewRemoteHost>\r\n", 33);
753751 length += 33;
754- memcpy (&buf[length], "<NewExternalPort>40000</NewExternalPort>\r\n", 42);
755- length += 42;
752+ sprintf (&buf[length], "<NewExternalPort>%d</NewExternalPort>\r\n", gateway_port);
753+ length = strlen(buf);
756754 memcpy (&buf[length], "<NewProtocol>UDP</NewProtocol>\r\n", 32);
757755 length += 32;
758756 memcpy (&buf[length], "</m:DeletePortMapping>\r\n", 21);
@@ -804,8 +802,8 @@ void send_upnp_port_info(void)
804802 length = strlen(buf);
805803 memcpy (&buf[length], "<NewRemoteHost></NewRemoteHost>\r\n", 33);
806804 length += 33;
807- memcpy (&buf[length], "<NewExternalPort>40000</NewExternalPort>\r\n", 42);
808- length += 42;
805+ sprintf (&buf[length], "<NewExternalPort>%d</NewExternalPort>\r\n", gateway_port);
806+ length = strlen(buf);
809807 memcpy (&buf[length], "<NewProtocol>UDP</NewProtocol>\r\n", 32);
810808 length += 32;
811809 memcpy (&buf[length], "</m:GetSpecificPortMappingEntry>\r\n", 34);
Show on old repository browser