🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #56289

IP-level socket options

#56289
From: Jeffrey M. Vinocur
Date: Mon, 04 Feb 2002 06:58
67 lines
2540 bytes
We're trying to figure out the intent of RCfix_options() in INN's
innd/rc.c.  The comment above reads:

  * Routine to disable IP-level socket options. This code was taken from 4.4BSD
  * rlogind source, but all mistakes in it are my fault.
 
and asking on inn-workers yields:

> > I believe it tries to avoid unwanted behavior like source
> > routing.
> 
> Yeah, similar to what TCP wrappers does.  I don't know if this is
> necessary any more or if anything actually cares.  

along with a suggestion to ask here to see what other people
think.

So, other people...?





Code, for reference:


/* fix_options - get rid of IP-level socket options */
#ifndef IP_OPTIONS
#define IP_OPTIONS 1
#endif

int
RCfix_options(int fd, struct sockaddr_in *remote)
{
#if IP_OPTIONS
    unsigned char optbuf[BUFSIZ / 3], *cp;
    char    lbuf[BUFSIZ], *lp;
    ARGTYPE optsize = sizeof(optbuf);
    int     ipproto;
    struct protoent *ip;

    if ((ip = getprotobyname("ip")) != 0)
	ipproto = ip->p_proto;
    else
	ipproto = IPPROTO_IP;

    if (getsockopt(fd, ipproto, IP_OPTIONS, (char *) optbuf, &optsize) == 0
	&& optsize != 0) {
	lp = lbuf;
	for (cp = optbuf; optsize > 0; cp++, optsize--, lp += 3)
	    sprintf(lp, " %2.2x", *cp);
	syslog(LOG_NOTICE,
	       "connect from %s with IP options (ignored):%s",
	       inet_ntoa(remote->sin_addr), lbuf);
	if (setsockopt(fd, ipproto, IP_OPTIONS, (char *) 0, optsize) != 0) {
	    syslog(LOG_ERR, "setsockopt IP_OPTIONS NULL: %m");
	    return -1;
	}
    }
#endif
    return 0;
}

-- 
Jeffrey M. Vinocur
jeff@litech.org
Technical Details
Message-ID: <a3lber$f83$1@marduk.litech.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!lnsnews.lns.cornell.edu!news.litech.org!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <a3lber$f83$1@marduk.litech.org>
Subject: IP-level socket options
Date: Mon, 04 Feb 2002 06:58:35 +0000
From: jeff@litech.org (Jeffrey M. Vinocur)
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!lnsnews.lns.cornell.edu!news.litech.org!not-for-mail
Newsgroups: news.software.nntp
Organization: Lithium Technologies
Lines: 66
Sender: jeff@litech.org
NNTP-Posting-Host: marduk.litech.org
X-Trace: marduk.litech.org 1012805915 15619 128.84.154.54 (4 Feb 2002 06:58:35 GMT)
X-Complaints-To: usenet@litech.org
NNTP-Posting-Date: Mon, 4 Feb 2002 06:58:35 +0000 (UTC)
X-Newsreader: trn 4.0-test76 (Apr 2, 2001)
Originator: jeff@litech.org (Jeffrey M. Vinocur)