~davewalker/ubuntu/lucid/dnsmasq/bug674645

« back to all changes in this revision

Viewing changes to src/forward.c

  • Committer: Bazaar Package Importer
  • Author(s): Simon Kelley
  • Date: 2009-02-07 19:25:23 UTC
  • mfrom: (10.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090207192523-zut5qet639v1httx
 * Fix bashism in init script. (closes: #514397)
 * Tweak logging in init script.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* dnsmasq is Copyright (c) 2000-2007 Simon Kelley
 
1
/* dnsmasq is Copyright (c) 2000-2009 Simon Kelley
2
2
 
3
3
   This program is free software; you can redistribute it and/or modify
4
4
   it under the terms of the GNU General Public License as published by
10
10
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
11
   GNU General Public License for more details.
12
12
     
13
 
  You should have received a copy of the GNU General Public License
14
 
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
13
   You should have received a copy of the GNU General Public License
 
14
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
15
*/
16
16
 
17
17
#include "dnsmasq.h"
381
381
  size_t plen; 
382
382
 
383
383
  /* If upstream is advertising a larger UDP packet size
384
 
         than we allow, trim it so that we don't get overlarge
385
 
         requests for the client. We can't do this for signed packets. */
 
384
     than we allow, trim it so that we don't get overlarge
 
385
     requests for the client. We can't do this for signed packets. */
386
386
 
387
387
  if ((pheader = find_pseudoheader(header, n, &plen, &sizep, &is_sign)) && !is_sign)
388
388
    {
918
918
     (eg) TFTP. Once we have a reasonable number, randomness should be OK */
919
919
 
920
920
  for (i = 0; i < RANDOM_SOCKS; i++)
921
 
    if (daemon->randomsocks[i].refcount == 0 && 
922
 
        (daemon->randomsocks[i].fd = random_sock(family)) != -1)
 
921
    if (daemon->randomsocks[i].refcount == 0)
923
922
      {
 
923
        if ((daemon->randomsocks[i].fd = random_sock(family)) == -1)
 
924
          break;
 
925
      
924
926
        daemon->randomsocks[i].refcount = 1;
925
927
        daemon->randomsocks[i].family = family;
926
928
        return &daemon->randomsocks[i];
927
929
      }
928
930
 
929
 
  /* No free ones, grab an existing one */
 
931
  /* No free ones or cannot get new socket, grab an existing one */
930
932
  for (i = 0; i < RANDOM_SOCKS; i++)
931
933
    {
932
934
      int j = (i+finger) % RANDOM_SOCKS;
933
 
      if (daemon->randomsocks[j].family == family && daemon->randomsocks[j].refcount != 0xffff)
 
935
      if (daemon->randomsocks[j].refcount != 0 &&
 
936
          daemon->randomsocks[j].family == family && 
 
937
          daemon->randomsocks[j].refcount != 0xffff)
934
938
        {
935
939
          finger = j;
936
940
          daemon->randomsocks[j].refcount++;