Project

General

Profile

Bug #4692 » SAT-IP-Cache-ip_check_is_local_address-call.diff

Mono Polimorph, 2017-11-21 22:16

View differences:

src/http.h
136 136
  char *hc_peer_ipstr;
137 137
  struct sockaddr_storage *hc_self;
138 138
  char *hc_representative;
139
  int is_local_address_cache;
139 140

  
140 141
  pthread_mutex_t  *hc_paths_mutex;
141 142
  http_path_list_t *hc_paths;
src/satip/rtsp.c
322 322
rtsp_conn_ip(http_connection_t *hc, char *buf, size_t buflen, int *port)
323 323
{
324 324
  const char *used_ip = rtsp_ip;
325
  int used_port = rtsp_port, local;
325
  int used_port = rtsp_port;
326
  int local = hc->is_local_address_cache;
326 327
  struct sockaddr_storage self;
327 328

  
328 329
  if (rtsp_nat_ip[0] == '\0')
329 330
    goto end;
330 331
  self = *hc->hc_self;
331 332
  /* note: call ip_check at first to initialize self (ip any) */
332
  local = ip_check_is_local_address(hc->hc_peer, hc->hc_self, &self);
333
  if (local < 0) {
334
    hc->is_local_address_cache = ip_check_is_local_address(hc->hc_peer, hc->hc_self, &self);
335
    local = hc->is_local_address_cache;
336
  }
333 337
  if (local || satip_server_conf.satip_nat_name_force) {
334 338
    used_ip = rtsp_nat_ip;
335 339
    if (rtsp_nat_port > 0)
......
1664 1668
  hc.hc_self    = self;
1665 1669
  hc.hc_process = rtsp_process_request;
1666 1670
  hc.hc_cseq    = 1;
1671
  hc.is_local_address_cache = -1;
1667 1672

  
1668 1673
  http_serve_requests(&hc);
1669 1674

  
(3-3/3)