Advertisement
Guest User

Untitled

a guest
Nov 15th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.50 KB | None | 0 0
  1. diff -ru sipsak-0.9.6/sipsak.1 sipsak-0.9.6.new/sipsak.1
  2. --- sipsak-0.9.6/sipsak.1 2006-01-28 21:11:34.000000000 +0000
  3. +++ sipsak-0.9.6.new/sipsak.1 2016-11-15 10:11:52.334403451 +0000
  4. @@ -297,6 +297,9 @@
  5. "\\n" (note: two characters) will be replaced with CRLF and thus result
  6. in two seperate headers. That way more then one header can be added.
  7.  
  8. +.IP "-k, --local-ip STRING"
  9. +The local ip address to be used
  10. +
  11. .IP "-l, --local-port PORT"
  12. The receiving UDP socket will use the local network
  13. .I port.
  14. diff -ru sipsak-0.9.6/sipsak.c sipsak-0.9.6.new/sipsak.c
  15. --- sipsak-0.9.6/sipsak.c 2006-01-28 21:11:50.000000000 +0000
  16. +++ sipsak-0.9.6.new/sipsak.c 2016-11-15 10:22:41.974067689 +0000
  17. @@ -149,6 +149,7 @@
  18. " and reliable transports (default: 64)\n"
  19. " --transport=STRING specify transport to be used\n"
  20. " --headers=STRING adds additional headers to the request\n"
  21. + " --local-ip=STRING specify local ip address to be used\n"
  22. );
  23. exit_code(0);
  24. }
  25. @@ -215,6 +216,7 @@
  26. " and reliable transports (default: 64)\n"
  27. " -E STRING specify transport to be used\n"
  28. " -j STRING adds additional headers to the request\n"
  29. + " -k STRING specify local ip address to be used\n"
  30. );
  31. exit_code(0);
  32. }
  33. @@ -277,6 +279,7 @@
  34. {"timeout-factor", 1, 0, 'D'},
  35. {"transport", 1, 0, 'E'},
  36. {"headers", 1, 0, 'j'},
  37. + {"local-ip", 1, 0, 'k'},
  38. {0, 0, 0, 0}
  39. };
  40. #endif
  41. @@ -287,7 +290,7 @@
  42. namebeg=nameend=maxforw= -1;
  43. numeric=via_ins=redirects=fix_crlf=processes = 1;
  44. username=password=replace_str=hostname=contact_uri=mes_body = NULL;
  45. - con_dis=auth_username=from_uri=headers = NULL;
  46. + con_dis=auth_username=from_uri=headers=localip = NULL;
  47. scheme = user = host = backup = req = rep = rec = NULL;
  48. re = NULL;
  49. address= 0;
  50. @@ -304,9 +307,9 @@
  51.  
  52. /* lots of command line switches to handle*/
  53. #ifdef HAVE_GETOPT_LONG
  54. - 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){
  55. + 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){
  56. #else
  57. - 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){
  58. + 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){
  59. #endif
  60. switch(c){
  61. case 'a':
  62. @@ -469,6 +472,9 @@
  63. case 'j':
  64. headers=optarg;
  65. break;
  66. + case 'k':
  67. + local_ip=optarg;
  68. + break;
  69. case 'l':
  70. lport=str_to_int(optarg);
  71. break;
  72. diff -ru sipsak-0.9.6/sipsak.h sipsak-0.9.6.new/sipsak.h
  73. --- sipsak-0.9.6/sipsak.h 2006-01-28 21:11:50.000000000 +0000
  74. +++ sipsak-0.9.6.new/sipsak.h 2016-11-15 10:16:49.463901224 +0000
  75. @@ -303,7 +303,7 @@
  76. int file_b, uri_b, trace, via_ins, usrloc, redirects, rand_rem, replace_b;
  77. int empty_contact, nagios_warn, fix_crlf, timing, outbound_proxy, inv_final;
  78. char *username, *domainname, *password, *replace_str, *hostname, *contact_uri;
  79. -char *mes_body, *con_dis, *auth_username, *from_uri, *headers;
  80. +char *mes_body, *con_dis, *auth_username, *from_uri, *headers, *local_ip;
  81. char fqdn[FQDN_SIZE];
  82. char target_dot[INET_ADDRSTRLEN], source_dot[INET_ADDRSTRLEN];
  83. char *req, *rep, *rec, *transport_str;
  84. diff -ru sipsak-0.9.6/transport.c sipsak-0.9.6.new/transport.c
  85. --- sipsak-0.9.6/transport.c 2006-01-28 21:11:34.000000000 +0000
  86. +++ sipsak-0.9.6.new/transport.c 2016-11-15 10:11:52.337405124 +0000
  87. @@ -75,7 +75,11 @@
  88.  
  89. memset(&(cd->adr), 0, sizeof(struct sockaddr_in));
  90. cd->adr.sin_family = AF_INET;
  91. - cd->adr.sin_addr.s_addr = htonl( INADDR_ANY);
  92. + if(local_ip) {
  93. + cd->adr.sin_addr.s_addr = inet_addr(local_ip);
  94. + } else {
  95. + cd->adr.sin_addr.s_addr = htonl( INADDR_ANY);
  96. + }
  97. cd->adr.sin_port = htons((short)lport);
  98.  
  99. if (transport == SIP_UDP_TRANSPORT) {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement