Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -ru sipsak-0.9.6/sipsak.1 sipsak-0.9.6.new/sipsak.1
- --- sipsak-0.9.6/sipsak.1 2006-01-28 21:11:34.000000000 +0000
- +++ sipsak-0.9.6.new/sipsak.1 2016-11-15 10:11:52.334403451 +0000
- @@ -297,6 +297,9 @@
- "\\n" (note: two characters) will be replaced with CRLF and thus result
- in two seperate headers. That way more then one header can be added.
- +.IP "-k, --local-ip STRING"
- +The local ip address to be used
- +
- .IP "-l, --local-port PORT"
- The receiving UDP socket will use the local network
- .I port.
- diff -ru sipsak-0.9.6/sipsak.c sipsak-0.9.6.new/sipsak.c
- --- sipsak-0.9.6/sipsak.c 2006-01-28 21:11:50.000000000 +0000
- +++ sipsak-0.9.6.new/sipsak.c 2016-11-15 10:22:41.974067689 +0000
- @@ -149,6 +149,7 @@
- " and reliable transports (default: 64)\n"
- " --transport=STRING specify transport to be used\n"
- " --headers=STRING adds additional headers to the request\n"
- + " --local-ip=STRING specify local ip address to be used\n"
- );
- exit_code(0);
- }
- @@ -215,6 +216,7 @@
- " and reliable transports (default: 64)\n"
- " -E STRING specify transport to be used\n"
- " -j STRING adds additional headers to the request\n"
- + " -k STRING specify local ip address to be used\n"
- );
- exit_code(0);
- }
- @@ -277,6 +279,7 @@
- {"timeout-factor", 1, 0, 'D'},
- {"transport", 1, 0, 'E'},
- {"headers", 1, 0, 'j'},
- + {"local-ip", 1, 0, 'k'},
- {0, 0, 0, 0}
- };
- #endif
- @@ -287,7 +290,7 @@
- namebeg=nameend=maxforw= -1;
- numeric=via_ins=redirects=fix_crlf=processes = 1;
- username=password=replace_str=hostname=contact_uri=mes_body = NULL;
- - con_dis=auth_username=from_uri=headers = NULL;
- + con_dis=auth_username=from_uri=headers=localip = NULL;
- scheme = user = host = backup = req = rep = rec = NULL;
- re = NULL;
- address= 0;
- @@ -304,9 +307,9 @@
- /* lots of command line switches to handle*/
- #ifdef HAVE_GETOPT_LONG
- - while ((c=getopt_long(argc, argv, "a:A:b:B:c:C:dD:e:E:f:Fg:GhH:iIj:l:Lm:MnNo:O:p:P:q:r:Rs:St:Tu:UvVwW:x:Xz:", l_opts, &option_index)) != EOF){
- + while ((c=getopt_long(argc, argv, "a:A:b:B:c:C:dD:e:E:f:Fg:GhH:iIj:k:l:Lm:MnNo:O:p:P:q:r:Rs:St:Tu:UvVwW:x:Xz:", l_opts, &option_index)) != EOF){
- #else
- - while ((c=getopt(argc, argv, "a:A:b:B:c:C:dD:e:E:f:Fg:GhH:iIj:l:Lm:MnNo:O:p:P:q:r:Rs:St:Tu:UvVwW:x:z:")) != EOF){
- + while ((c=getopt(argc, argv, "a:A:b:B:c:C:dD:e:E:f:Fg:GhH:iIj:k:l:Lm:MnNo:O:p:P:q:r:Rs:St:Tu:UvVwW:x:z:")) != EOF){
- #endif
- switch(c){
- case 'a':
- @@ -469,6 +472,9 @@
- case 'j':
- headers=optarg;
- break;
- + case 'k':
- + local_ip=optarg;
- + break;
- case 'l':
- lport=str_to_int(optarg);
- break;
- diff -ru sipsak-0.9.6/sipsak.h sipsak-0.9.6.new/sipsak.h
- --- sipsak-0.9.6/sipsak.h 2006-01-28 21:11:50.000000000 +0000
- +++ sipsak-0.9.6.new/sipsak.h 2016-11-15 10:16:49.463901224 +0000
- @@ -303,7 +303,7 @@
- int file_b, uri_b, trace, via_ins, usrloc, redirects, rand_rem, replace_b;
- int empty_contact, nagios_warn, fix_crlf, timing, outbound_proxy, inv_final;
- char *username, *domainname, *password, *replace_str, *hostname, *contact_uri;
- -char *mes_body, *con_dis, *auth_username, *from_uri, *headers;
- +char *mes_body, *con_dis, *auth_username, *from_uri, *headers, *local_ip;
- char fqdn[FQDN_SIZE];
- char target_dot[INET_ADDRSTRLEN], source_dot[INET_ADDRSTRLEN];
- char *req, *rep, *rec, *transport_str;
- diff -ru sipsak-0.9.6/transport.c sipsak-0.9.6.new/transport.c
- --- sipsak-0.9.6/transport.c 2006-01-28 21:11:34.000000000 +0000
- +++ sipsak-0.9.6.new/transport.c 2016-11-15 10:11:52.337405124 +0000
- @@ -75,7 +75,11 @@
- memset(&(cd->adr), 0, sizeof(struct sockaddr_in));
- cd->adr.sin_family = AF_INET;
- - cd->adr.sin_addr.s_addr = htonl( INADDR_ANY);
- + if(local_ip) {
- + cd->adr.sin_addr.s_addr = inet_addr(local_ip);
- + } else {
- + cd->adr.sin_addr.s_addr = htonl( INADDR_ANY);
- + }
- cd->adr.sin_port = htons((short)lport);
- if (transport == SIP_UDP_TRANSPORT) {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement