fix_options.c (44744) | fix_options.c (56977) |
---|---|
1 /* 2 * Routine to disable IP-level socket options. This code was taken from 4.4BSD 3 * rlogind and kernel source, but all mistakes in it are my fault. 4 * 5 * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands. | 1 /* 2 * Routine to disable IP-level socket options. This code was taken from 4.4BSD 3 * rlogind and kernel source, but all mistakes in it are my fault. 4 * 5 * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands. |
6 * 7 * $FreeBSD: head/contrib/tcp_wrappers/fix_options.c 56977 2000-02-03 10:27:03Z shin $ |
|
6 */ 7 8#ifndef lint 9static char sccsid[] = "@(#) fix_options.c 1.6 97/04/08 02:29:19"; 10#endif 11 12#include <sys/types.h> 13#include <sys/param.h> | 8 */ 9 10#ifndef lint 11static char sccsid[] = "@(#) fix_options.c 1.6 97/04/08 02:29:19"; 12#endif 13 14#include <sys/types.h> 15#include <sys/param.h> |
16#ifdef INET6 17#include <sys/socket.h> 18#endif |
|
14#include <netinet/in.h> 15#include <netinet/in_systm.h> 16#include <netinet/ip.h> 17#include <netdb.h> 18#include <stdio.h> 19#include <syslog.h> 20 21#ifndef IPOPT_OPTVAL --- 14 unchanged lines hidden (view full) --- 36 unsigned char optbuf[BUFFER_SIZE / 3], *cp; 37 char lbuf[BUFFER_SIZE], *lp; 38 int optsize = sizeof(optbuf), ipproto; 39 struct protoent *ip; 40 int fd = request->fd; 41 unsigned int opt; 42 int optlen; 43 struct in_addr dummy; | 19#include <netinet/in.h> 20#include <netinet/in_systm.h> 21#include <netinet/ip.h> 22#include <netdb.h> 23#include <stdio.h> 24#include <syslog.h> 25 26#ifndef IPOPT_OPTVAL --- 14 unchanged lines hidden (view full) --- 41 unsigned char optbuf[BUFFER_SIZE / 3], *cp; 42 char lbuf[BUFFER_SIZE], *lp; 43 int optsize = sizeof(optbuf), ipproto; 44 struct protoent *ip; 45 int fd = request->fd; 46 unsigned int opt; 47 int optlen; 48 struct in_addr dummy; |
49#ifdef INET6 50 struct sockaddr_storage ss; 51 int sslen; |
|
44 | 52 |
53 /* 54 * check if this is AF_INET socket 55 * XXX IPv6 support? 56 */ 57 sslen = sizeof(ss); 58 if (getsockname(fd, (struct sockaddr *)&ss, &sslen) < 0) { 59 syslog(LOG_ERR, "getpeername: %m"); 60 clean_exit(request); 61 } 62 if (ss.ss_family != AF_INET) 63 return; 64#endif 65 |
|
45 if ((ip = getprotobyname("ip")) != 0) 46 ipproto = ip->p_proto; 47 else 48 ipproto = IPPROTO_IP; 49 50 if (getsockopt(fd, ipproto, IP_OPTIONS, (char *) optbuf, &optsize) == 0 51 && optsize != 0) { 52 --- 57 unchanged lines hidden --- | 66 if ((ip = getprotobyname("ip")) != 0) 67 ipproto = ip->p_proto; 68 else 69 ipproto = IPPROTO_IP; 70 71 if (getsockopt(fd, ipproto, IP_OPTIONS, (char *) optbuf, &optsize) == 0 72 && optsize != 0) { 73 --- 57 unchanged lines hidden --- |