line lengths in /etc/hosts

2013-03-27 Thread Perry Hutchison
Is there a limit on line length in FreeBSD's /etc/hosts?

I'm not finding any mention of such a limit in hosts(5), but
characters beyond the first 660 or so seem to be ignored.

To answer the inevitable followup why would anyone need such
a long line in /etc/hosts:

With this line in /etc/nsswitch.conf

  hosts: files dns

I can easily suppress access to unwanted web sites by adding
names to the localhost line in /etc/hosts, like this:

  127.0.0.1 localhost localhost.my.domain bad1.com bad2.com ...

My version of that line has gotten rather long :)
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: line lengths in /etc/hosts

2013-03-27 Thread Polytropon
On Wed, 27 Mar 2013 01:57:48 -0700, Perry Hutchison wrote:
 I can easily suppress access to unwanted web sites by adding
 names to the localhost line in /etc/hosts, like this:
 
   127.0.0.1   localhost localhost.my.domain bad1.com bad2.com ...
 
 My version of that line has gotten rather long :)

Without actually havint tested this, but have you considered
using the \ continuation character (linebreak escape) to avoid
the problem? Also I think there's not a generic limit to the
/etc/hosts file itself, but maybe to the input buffers of the
programs that read this file...


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: line lengths in /etc/hosts

2013-03-27 Thread Erik Nørgaard
On 27 Mar 2013, at 09:57, per...@pluto.rain.com (Perry Hutchison) wrote:

 Is there a limit on line length in FreeBSD's /etc/hosts?
 
 I'm not finding any mention of such a limit in hosts(5), but
 characters beyond the first 660 or so seem to be ignored.
 
 To answer the inevitable followup why would anyone need such
 a long line in /etc/hosts:
 
 With this line in /etc/nsswitch.conf
 
  hosts: files dns
 
 I can easily suppress access to unwanted web sites by adding
 names to the localhost line in /etc/hosts, like this:
 
  127.0.0.1localhost localhost.my.domain bad1.com bad2.com ...
 
 My version of that line has gotten rather long :)

AFAIK you can have multiple lines. 

BR
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: line lengths in /etc/hosts

2013-03-27 Thread Erich Dollansky
Hi,

On Wed, 27 Mar 2013 10:09:29 +0100
Erik Nørgaard norga...@locolomo.org wrote:

 On 27 Mar 2013, at 09:57, per...@pluto.rain.com (Perry Hutchison)
 wrote:
 
  Is there a limit on line length in FreeBSD's /etc/hosts?
  
  I'm not finding any mention of such a limit in hosts(5), but
  characters beyond the first 660 or so seem to be ignored.
  
  To answer the inevitable followup why would anyone need such
  a long line in /etc/hosts:
  
  With this line in /etc/nsswitch.conf
  
   hosts: files dns
  
  I can easily suppress access to unwanted web sites by adding
  names to the localhost line in /etc/hosts, like this:
  
   127.0.0.1localhost localhost.my.domain bad1.com bad2.com ...
  
  My version of that line has gotten rather long :)
 
 AFAIK you can have multiple lines. 
 
yes, I have hundreds or even thousands of lines and never ran into any
problems.

Erich
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

Re: line lengths in /etc/hosts

2013-03-27 Thread Walter Hurry
On Wed, 27 Mar 2013 01:57:48 -0700, Perry Hutchison wrote:

 Is there a limit on line length in FreeBSD's /etc/hosts?
 
 I'm not finding any mention of such a limit in hosts(5), but characters
 beyond the first 660 or so seem to be ignored.
 
 To answer the inevitable followup why would anyone need such a long
 line in /etc/hosts:
 
 With this line in /etc/nsswitch.conf
 
   hosts: files dns
 
 I can easily suppress access to unwanted web sites by adding names to
 the localhost line in /etc/hosts, like this:
 
   127.0.0.1   localhost localhost.my.domain bad1.com bad2.com ...
 
 My version of that line has gotten rather long :)

$ tail -20 /etc/hosts
127.0.0.1  r1.zedo.com
127.0.0.1  simg.zedo.com
127.0.0.1  ss1.zedo.com
127.0.0.1  ss2.zedo.com
127.0.0.1  ss7.zedo.com
127.0.0.1  xads.zedo.com
127.0.0.1  yads.zedo.com
127.0.0.1  www.zedo.com #[Adware.RaxSearch]
127.0.0.1  c1.zxxds.net #[g1.panthercdn.com]
127.0.0.1  c7.zxxds.net
# [Zero Lag][AS20093][67.201.0.0 - 67.201.63.255]
127.0.0.1  ads.namiflow.com
127.0.0.1  adunit.namiflow.com
# [Zero Lag][AS20093][68.71.240.0 - 68.71.255.255]
127.0.0.1  rt.udmserve.net
# [Zero Lag][AS20093][72.37.216.0 - 72.37.217.255]
127.0.0.1  www.stickylogic.com
127.0.0.1  www.winadiscount.com #[Dr.Web.Adware.Xbarre]
127.0.0.1  www.winaproduct.com
# [end of entries generated by MVPS HOSTS]
$ 

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org