diff options
author | Waldemar Brodkorb <wbrodkorb@conet.de> | 2015-03-04 09:21:57 +0100 |
---|---|---|
committer | Waldemar Brodkorb <wbrodkorb@conet.de> | 2015-03-04 09:21:57 +0100 |
commit | 4fc74012b67cfc62c5481b8d7b6d95052f40c2bf (patch) | |
tree | d6f7c860195c63564d98f53c143acbf0082ea3ca /package/supl/patches/patch-src_supl_c | |
parent | 68b4cb5aaa95eb39401bcbaa7c517cfd31c3edcf (diff) | |
parent | 9919c4bc2f53037331313edace085c386c2af4cc (diff) |
Merge branch 'master' of git+ssh://openadk.org/git/openadk
Diffstat (limited to 'package/supl/patches/patch-src_supl_c')
-rw-r--r-- | package/supl/patches/patch-src_supl_c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/package/supl/patches/patch-src_supl_c b/package/supl/patches/patch-src_supl_c new file mode 100644 index 000000000..26ab45b18 --- /dev/null +++ b/package/supl/patches/patch-src_supl_c @@ -0,0 +1,46 @@ + - implement bind to device functionality +--- trunk.orig/src/supl.c 2011-10-27 20:41:19.000000000 +0200 ++++ trunk/src/supl.c 2013-04-24 18:56:17.742529773 +0200 +@@ -41,7 +41,7 @@ static struct supl_debug_s { + } debug; + #endif + +-static int server_connect(char *server); ++static int server_connect(char *server, char *iface); + static int pdu_make_ulp_start(supl_ctx_t *ctx, supl_ulp_t *pdu); + static int pdu_make_ulp_pos_init(supl_ctx_t *ctx, supl_ulp_t *pdu); + static int pdu_make_ulp_rrlp_ack(supl_ctx_t *ctx, supl_ulp_t *pdu, PDU_t *rrlp); +@@ -236,7 +236,7 @@ int EXPORT supl_server_connect(supl_ctx_ + if (!ctx->ssl) return E_SUPL_CONNECT; + + if (server) { +- ctx->fd = server_connect(server); ++ ctx->fd = server_connect(server, ctx->iface); + if (ctx->fd == -1) return E_SUPL_CONNECT; + } + +@@ -266,7 +266,7 @@ void EXPORT supl_close(supl_ctx_t *ctx) + } + + +-static int server_connect(char *server) { ++static int server_connect(char *server, char *iface) { + int fd = -1; + struct addrinfo *ailist, *aip; + struct addrinfo hint; +@@ -283,6 +283,15 @@ static int server_connect(char *server) + if ((fd = socket(aip->ai_family, SOCK_STREAM, 0)) < 0) { + err = errno; + } ++ ++ if (strlen(iface)) { ++ struct ifreq ifr; ++ strncpy(ifr.ifr_name, iface, IFNAMSIZ); ++ ifr.ifr_name[IFNAMSIZ - 1] = 0; ++ if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr))) ++ fprintf(stderr, "Error: binding to device %s failed\n", iface); ++ } ++ + if (connect(fd, aip->ai_addr, aip->ai_addrlen) != 0) { + return -1; + } |