Blame resolv/res_enable_icmp.c
|
Packit Service |
4b1077 |
/* Enable full ICMP errors on a socket.
|
|
Packit Service |
4b1077 |
Copyright (C) 2019 Free Software Foundation, Inc.
|
|
Packit Service |
4b1077 |
This file is part of the GNU C Library.
|
|
Packit Service |
4b1077 |
|
|
Packit Service |
4b1077 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit Service |
4b1077 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
4b1077 |
License as published by the Free Software Foundation; either
|
|
Packit Service |
4b1077 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
4b1077 |
|
|
Packit Service |
4b1077 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit Service |
4b1077 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
4b1077 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
4b1077 |
Lesser General Public License for more details.
|
|
Packit Service |
4b1077 |
|
|
Packit Service |
4b1077 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
4b1077 |
License along with the GNU C Library; if not, see
|
|
Packit Service |
4b1077 |
<http://www.gnu.org/licenses/>. */
|
|
Packit Service |
4b1077 |
|
|
Packit Service |
4b1077 |
#include <errno.h>
|
|
Packit Service |
4b1077 |
#include <netinet/in.h>
|
|
Packit Service |
4b1077 |
#include <sys/socket.h>
|
|
Packit Service |
4b1077 |
|
|
Packit Service |
4b1077 |
int
|
|
Packit Service |
4b1077 |
__res_enable_icmp (int family, int fd)
|
|
Packit Service |
4b1077 |
{
|
|
Packit Service |
4b1077 |
int one = 1;
|
|
Packit Service |
4b1077 |
switch (family)
|
|
Packit Service |
4b1077 |
{
|
|
Packit Service |
4b1077 |
case AF_INET:
|
|
Packit Service |
4b1077 |
return setsockopt (fd, SOL_IP, IP_RECVERR, &one, sizeof (one));
|
|
Packit Service |
4b1077 |
case AF_INET6:
|
|
Packit Service |
4b1077 |
return setsockopt (fd, SOL_IPV6, IPV6_RECVERR, &one, sizeof (one));
|
|
Packit Service |
4b1077 |
default:
|
|
Packit Service |
4b1077 |
__set_errno (EAFNOSUPPORT);
|
|
Packit Service |
4b1077 |
return -1;
|
|
Packit Service |
4b1077 |
}
|
|
Packit Service |
4b1077 |
}
|