mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-26 06:50:07 +00:00
[BZ #966]
2005-06-13 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/clock_gettime.c (clock_gettime): Implement case where HANDLED_REALTIME is not defined. [BZ #966] 2005-06-13 Jakub Jelinek <jakub@redhat.com> * sysdeps/unix/sysv/linux/netlinkaccess.h (__netlink_sendreq, __netlink_receive): Remove prototypes. (__netlink_request): New prototype. * sysdeps/unix/sysv/linux/ifaddrs.c: Include <alloca.h> and <stdint.h>. (__netlink_sendreq): Make static. (__netlink_receive): Rename to... (__netlink_request): ... this. Add type argument, call __netlink_sendreq. If MSG_TRUNC is set after recvmsg, retry with a bigger buffer. Don't record buffers that contain no messages we are expecting. (getifaddrs): Use __netlink_request instead of __netlink_sendreq and __netlink_receive pairs. Formatting. * sysdeps/unix/sysv/linux/if_index.c (if_nameindex_netlink): Use __netlink_request instead of __netlink_sendreq and __netlink_receive pair. 2005-06-13 Thorsten Kukuk <kukuk@suse.de> * sysdeps/unix/sysv/linux/netinet/if_tr.h: Don't include kernel headers, instead copy important structs/defines. 2005-06-13 Jakub Jelinek <jakub@redhat.com> * elf/rtld.c (dl_main): Move DT_DEBUG setup before first _dl_debug_state call.
This commit is contained in:
parent
74780cf659
commit
c63d8f809b
34
ChangeLog
34
ChangeLog
@ -1,3 +1,37 @@
|
|||||||
|
2005-06-13 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/unix/clock_gettime.c (clock_gettime): Implement case
|
||||||
|
where HANDLED_REALTIME is not defined. [BZ #966]
|
||||||
|
|
||||||
|
2005-06-13 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/unix/sysv/linux/netlinkaccess.h (__netlink_sendreq,
|
||||||
|
__netlink_receive): Remove prototypes.
|
||||||
|
(__netlink_request): New prototype.
|
||||||
|
* sysdeps/unix/sysv/linux/ifaddrs.c: Include <alloca.h> and
|
||||||
|
<stdint.h>.
|
||||||
|
(__netlink_sendreq): Make static.
|
||||||
|
(__netlink_receive): Rename to...
|
||||||
|
(__netlink_request): ... this. Add type argument, call
|
||||||
|
__netlink_sendreq. If MSG_TRUNC is set after recvmsg, retry
|
||||||
|
with a bigger buffer. Don't record buffers that contain no
|
||||||
|
messages we are expecting.
|
||||||
|
(getifaddrs): Use __netlink_request instead of __netlink_sendreq
|
||||||
|
and __netlink_receive pairs. Formatting.
|
||||||
|
* sysdeps/unix/sysv/linux/if_index.c (if_nameindex_netlink): Use
|
||||||
|
__netlink_request instead of __netlink_sendreq and __netlink_receive
|
||||||
|
pair.
|
||||||
|
|
||||||
|
2005-06-13 Thorsten Kukuk <kukuk@suse.de>
|
||||||
|
|
||||||
|
* sysdeps/unix/sysv/linux/netinet/if_tr.h: Don't include kernel
|
||||||
|
headers, instead copy important structs/defines.
|
||||||
|
|
||||||
|
2005-06-13 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* elf/rtld.c (dl_main): Move DT_DEBUG setup before first
|
||||||
|
_dl_debug_state call.
|
||||||
|
|
||||||
2005-06-12 Ulrich Drepper <drepper@redhat.com>
|
2005-06-12 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* elf/dl-error.c (_dl_signal_error): Store information about use of
|
* elf/dl-error.c (_dl_signal_error): Store information about use of
|
||||||
|
41
elf/rtld.c
41
elf/rtld.c
@ -1558,6 +1558,23 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set up debugging before the debugger is notified for the first time. */
|
||||||
|
#ifdef ELF_MACHINE_DEBUG_SETUP
|
||||||
|
/* Some machines (e.g. MIPS) don't use DT_DEBUG in this way. */
|
||||||
|
ELF_MACHINE_DEBUG_SETUP (main_map, r);
|
||||||
|
ELF_MACHINE_DEBUG_SETUP (&GL(dl_rtld_map), r);
|
||||||
|
#else
|
||||||
|
if (main_map->l_info[DT_DEBUG] != NULL)
|
||||||
|
/* There is a DT_DEBUG entry in the dynamic section. Fill it in
|
||||||
|
with the run-time address of the r_debug structure */
|
||||||
|
main_map->l_info[DT_DEBUG]->d_un.d_ptr = (ElfW(Addr)) r;
|
||||||
|
|
||||||
|
/* Fill in the pointer in the dynamic linker's own dynamic section, in
|
||||||
|
case you run gdb on the dynamic linker directly. */
|
||||||
|
if (GL(dl_rtld_map).l_info[DT_DEBUG] != NULL)
|
||||||
|
GL(dl_rtld_map).l_info[DT_DEBUG]->d_un.d_ptr = (ElfW(Addr)) r;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* We start adding objects. */
|
/* We start adding objects. */
|
||||||
r->r_state = RT_ADD;
|
r->r_state = RT_ADD;
|
||||||
_dl_debug_state ();
|
_dl_debug_state ();
|
||||||
@ -2076,30 +2093,6 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
|
||||||
struct link_map *l = main_map;
|
|
||||||
|
|
||||||
#ifdef ELF_MACHINE_DEBUG_SETUP
|
|
||||||
|
|
||||||
/* Some machines (e.g. MIPS) don't use DT_DEBUG in this way. */
|
|
||||||
|
|
||||||
ELF_MACHINE_DEBUG_SETUP (l, r);
|
|
||||||
ELF_MACHINE_DEBUG_SETUP (&GL(dl_rtld_map), r);
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
if (l->l_info[DT_DEBUG] != NULL)
|
|
||||||
/* There is a DT_DEBUG entry in the dynamic section. Fill it in
|
|
||||||
with the run-time address of the r_debug structure */
|
|
||||||
l->l_info[DT_DEBUG]->d_un.d_ptr = (ElfW(Addr)) r;
|
|
||||||
|
|
||||||
/* Fill in the pointer in the dynamic linker's own dynamic section, in
|
|
||||||
case you run gdb on the dynamic linker directly. */
|
|
||||||
if (GL(dl_rtld_map).l_info[DT_DEBUG] != NULL)
|
|
||||||
GL(dl_rtld_map).l_info[DT_DEBUG]->d_un.d_ptr = (ElfW(Addr)) r;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now set up the variable which helps the assembler startup code. */
|
/* Now set up the variable which helps the assembler startup code. */
|
||||||
GL(dl_ns)[LM_ID_BASE]._ns_main_searchlist = &main_map->l_searchlist;
|
GL(dl_ns)[LM_ID_BASE]._ns_main_searchlist = &main_map->l_searchlist;
|
||||||
GL(dl_ns)[LM_ID_BASE]._ns_global_scope[0] = &main_map->l_searchlist;
|
GL(dl_ns)[LM_ID_BASE]._ns_global_scope[0] = &main_map->l_searchlist;
|
||||||
|
@ -93,6 +93,7 @@ int
|
|||||||
clock_gettime (clockid_t clock_id, struct timespec *tp)
|
clock_gettime (clockid_t clock_id, struct timespec *tp)
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
struct timeval tv;
|
||||||
|
|
||||||
switch (clock_id)
|
switch (clock_id)
|
||||||
{
|
{
|
||||||
@ -102,7 +103,9 @@ clock_gettime (clockid_t clock_id, struct timespec *tp)
|
|||||||
|
|
||||||
#ifndef HANDLED_REALTIME
|
#ifndef HANDLED_REALTIME
|
||||||
case CLOCK_REALTIME:
|
case CLOCK_REALTIME:
|
||||||
HANDLE_REALTIME;
|
retval = gettimeofday (&tv, NULL);
|
||||||
|
if (retval == 0)
|
||||||
|
TIMEVAL_TO_TIMESPEC (&tv, tp);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* Copyright (C) 1997,98,99,2000,2002,2003,2004 Free Software Foundation, Inc.
|
/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005
|
||||||
|
Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -188,12 +189,8 @@ if_nameindex_netlink (void)
|
|||||||
|
|
||||||
|
|
||||||
/* Tell the kernel that we wish to get a list of all
|
/* Tell the kernel that we wish to get a list of all
|
||||||
active interfaces. */
|
active interfaces. Collect all data for every interface. */
|
||||||
if (__netlink_sendreq (&nh, RTM_GETLINK) < 0)
|
if (__netlink_request (&nh, RTM_GETLINK) < 0)
|
||||||
goto exit_close;
|
|
||||||
|
|
||||||
/* Collect all data for every interface. */
|
|
||||||
if (__netlink_receive (&nh) < 0)
|
|
||||||
goto exit_free;
|
goto exit_free;
|
||||||
|
|
||||||
/* Count the interfaces. */
|
/* Count the interfaces. */
|
||||||
@ -290,7 +287,6 @@ if_nameindex_netlink (void)
|
|||||||
|
|
||||||
exit_free:
|
exit_free:
|
||||||
__netlink_free_handle (&nh);
|
__netlink_free_handle (&nh);
|
||||||
exit_close:
|
|
||||||
__netlink_close (&nh);
|
__netlink_close (&nh);
|
||||||
|
|
||||||
return idx;
|
return idx;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* getifaddrs -- get names and addresses of all network interfaces
|
/* getifaddrs -- get names and addresses of all network interfaces
|
||||||
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
|
Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -17,6 +17,7 @@
|
|||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||||
02111-1307 USA. */
|
02111-1307 USA. */
|
||||||
|
|
||||||
|
#include <alloca.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <ifaddrs.h>
|
#include <ifaddrs.h>
|
||||||
@ -24,6 +25,7 @@
|
|||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <netpacket/packet.h>
|
#include <netpacket/packet.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
@ -84,7 +86,7 @@ __netlink_free_handle (struct netlink_handle *h)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
static int
|
||||||
__netlink_sendreq (struct netlink_handle *h, int type)
|
__netlink_sendreq (struct netlink_handle *h, int type)
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
@ -114,15 +116,39 @@ __netlink_sendreq (struct netlink_handle *h, int type)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
__netlink_receive (struct netlink_handle *h)
|
__netlink_request (struct netlink_handle *h, int type)
|
||||||
{
|
{
|
||||||
struct netlink_res *nlm_next;
|
struct netlink_res *nlm_next;
|
||||||
char buf[4096];
|
struct netlink_res **new_nlm_list;
|
||||||
struct iovec iov = { buf, sizeof (buf) };
|
static volatile size_t buf_size = 4096;
|
||||||
|
char *buf;
|
||||||
struct sockaddr_nl nladdr;
|
struct sockaddr_nl nladdr;
|
||||||
struct nlmsghdr *nlmh;
|
struct nlmsghdr *nlmh;
|
||||||
int read_len;
|
ssize_t read_len;
|
||||||
bool done = false;
|
bool done = false;
|
||||||
|
bool use_malloc = false;
|
||||||
|
|
||||||
|
if (__netlink_sendreq (h, type) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
size_t this_buf_size = buf_size;
|
||||||
|
if (__libc_use_alloca (this_buf_size))
|
||||||
|
buf = alloca (this_buf_size);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buf = malloc (this_buf_size);
|
||||||
|
if (buf != NULL)
|
||||||
|
use_malloc = true;
|
||||||
|
else
|
||||||
|
goto out_fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct iovec iov = { buf, this_buf_size };
|
||||||
|
|
||||||
|
if (h->nlm_list != NULL)
|
||||||
|
new_nlm_list = &h->end_ptr->next;
|
||||||
|
else
|
||||||
|
new_nlm_list = &h->nlm_list;
|
||||||
|
|
||||||
while (! done)
|
while (! done)
|
||||||
{
|
{
|
||||||
@ -136,33 +162,66 @@ __netlink_receive (struct netlink_handle *h)
|
|||||||
|
|
||||||
read_len = TEMP_FAILURE_RETRY (__recvmsg (h->fd, &msg, 0));
|
read_len = TEMP_FAILURE_RETRY (__recvmsg (h->fd, &msg, 0));
|
||||||
if (read_len < 0)
|
if (read_len < 0)
|
||||||
return -1;
|
goto out_fail;
|
||||||
|
|
||||||
if (msg.msg_flags & MSG_TRUNC)
|
if (nladdr.nl_pid != 0)
|
||||||
return -1;
|
continue;
|
||||||
|
|
||||||
nlm_next = (struct netlink_res *) malloc (sizeof (struct netlink_res)
|
if (__builtin_expect (msg.msg_flags & MSG_TRUNC, 0))
|
||||||
+ read_len);
|
|
||||||
if (nlm_next == NULL)
|
|
||||||
return -1;
|
|
||||||
nlm_next->next = NULL;
|
|
||||||
nlm_next->nlh = memcpy (nlm_next + 1, buf, read_len);
|
|
||||||
nlm_next->size = read_len;
|
|
||||||
nlm_next->seq = h->seq;
|
|
||||||
if (h->nlm_list == NULL)
|
|
||||||
h->nlm_list = nlm_next;
|
|
||||||
else
|
|
||||||
h->end_ptr->next = nlm_next;
|
|
||||||
h->end_ptr = nlm_next;
|
|
||||||
|
|
||||||
for (nlmh = (struct nlmsghdr *) buf;
|
|
||||||
NLMSG_OK (nlmh, (size_t) read_len);
|
|
||||||
nlmh = (struct nlmsghdr *) NLMSG_NEXT (nlmh, read_len))
|
|
||||||
{
|
{
|
||||||
if (nladdr.nl_pid != 0 || (pid_t) nlmh->nlmsg_pid != h->pid
|
if (this_buf_size >= SIZE_MAX / 2)
|
||||||
|
goto out_fail;
|
||||||
|
|
||||||
|
nlm_next = *new_nlm_list;
|
||||||
|
while (nlm_next != NULL)
|
||||||
|
{
|
||||||
|
struct netlink_res *tmpptr;
|
||||||
|
|
||||||
|
tmpptr = nlm_next->next;
|
||||||
|
free (nlm_next);
|
||||||
|
nlm_next = tmpptr;
|
||||||
|
}
|
||||||
|
*new_nlm_list = NULL;
|
||||||
|
|
||||||
|
if (__libc_use_alloca (2 * this_buf_size))
|
||||||
|
buf = extend_alloca (buf, this_buf_size, 2 * this_buf_size);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this_buf_size *= 2;
|
||||||
|
|
||||||
|
char *new_buf = realloc (use_malloc ? buf : NULL, this_buf_size);
|
||||||
|
if (new_buf == NULL)
|
||||||
|
goto out_fail;
|
||||||
|
new_buf = buf;
|
||||||
|
|
||||||
|
use_malloc = true;
|
||||||
|
}
|
||||||
|
buf_size = this_buf_size;
|
||||||
|
|
||||||
|
iov.iov_base = buf;
|
||||||
|
iov.iov_len = this_buf_size;
|
||||||
|
|
||||||
|
/* Increase sequence number, so that we can distinguish
|
||||||
|
between old and new request messages. */
|
||||||
|
h->seq++;
|
||||||
|
|
||||||
|
if (__netlink_sendreq (h, type) < 0)
|
||||||
|
goto out_fail;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t count = 0;
|
||||||
|
size_t remaining_len = read_len;
|
||||||
|
for (nlmh = (struct nlmsghdr *) buf;
|
||||||
|
NLMSG_OK (nlmh, remaining_len);
|
||||||
|
nlmh = (struct nlmsghdr *) NLMSG_NEXT (nlmh, remaining_len))
|
||||||
|
{
|
||||||
|
if ((pid_t) nlmh->nlmsg_pid != h->pid
|
||||||
|| nlmh->nlmsg_seq != h->seq)
|
|| nlmh->nlmsg_seq != h->seq)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
++count;
|
||||||
if (nlmh->nlmsg_type == NLMSG_DONE)
|
if (nlmh->nlmsg_type == NLMSG_DONE)
|
||||||
{
|
{
|
||||||
/* We found the end, leave the loop. */
|
/* We found the end, leave the loop. */
|
||||||
@ -176,11 +235,38 @@ __netlink_receive (struct netlink_handle *h)
|
|||||||
errno = EIO;
|
errno = EIO;
|
||||||
else
|
else
|
||||||
errno = -nlerr->error;
|
errno = -nlerr->error;
|
||||||
return -1;
|
goto out_fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If there was nothing with the expected nlmsg_pid and nlmsg_seq,
|
||||||
|
there is no point to record it. */
|
||||||
|
if (count == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
nlm_next = (struct netlink_res *) malloc (sizeof (struct netlink_res)
|
||||||
|
+ read_len);
|
||||||
|
if (nlm_next == NULL)
|
||||||
|
goto out_fail;
|
||||||
|
nlm_next->next = NULL;
|
||||||
|
nlm_next->nlh = memcpy (nlm_next + 1, buf, read_len);
|
||||||
|
nlm_next->size = read_len;
|
||||||
|
nlm_next->seq = h->seq;
|
||||||
|
if (h->nlm_list == NULL)
|
||||||
|
h->nlm_list = nlm_next;
|
||||||
|
else
|
||||||
|
h->end_ptr->next = nlm_next;
|
||||||
|
h->end_ptr = nlm_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (use_malloc)
|
||||||
|
free (buf);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
out_fail:
|
||||||
|
if (use_malloc)
|
||||||
|
free (buf);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -288,28 +374,20 @@ getifaddrs (struct ifaddrs **ifap)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Tell the kernel that we wish to get a list of all
|
/* Tell the kernel that we wish to get a list of all
|
||||||
active interfaces. */
|
active interfaces, collect all data for every interface. */
|
||||||
if (__netlink_sendreq (&nh, RTM_GETLINK) < 0)
|
if (__netlink_request (&nh, RTM_GETLINK) < 0)
|
||||||
{
|
|
||||||
result = -1;
|
|
||||||
goto exit_close;
|
|
||||||
}
|
|
||||||
/* Collect all data for every interface. */
|
|
||||||
if (__netlink_receive (&nh) < 0)
|
|
||||||
{
|
{
|
||||||
result = -1;
|
result = -1;
|
||||||
goto exit_free;
|
goto exit_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Now ask the kernel for all addresses which are assigned
|
/* Now ask the kernel for all addresses which are assigned
|
||||||
to an interface. Since we store the addresses after the
|
to an interface and collect all data for every interface.
|
||||||
interfaces in the list, we will later always find the
|
Since we store the addresses after the interfaces in the
|
||||||
interface before the corresponding addresses. */
|
list, we will later always find the interface before the
|
||||||
|
corresponding addresses. */
|
||||||
++nh.seq;
|
++nh.seq;
|
||||||
if (__netlink_sendreq (&nh, RTM_GETADDR) < 0
|
if (__netlink_request (&nh, RTM_GETADDR) < 0)
|
||||||
/* Collect all data for every interface. */
|
|
||||||
|| __netlink_receive (&nh) < 0)
|
|
||||||
{
|
{
|
||||||
result = -1;
|
result = -1;
|
||||||
goto exit_free;
|
goto exit_free;
|
||||||
@ -767,8 +845,6 @@ getifaddrs (struct ifaddrs **ifap)
|
|||||||
|
|
||||||
exit_free:
|
exit_free:
|
||||||
__netlink_free_handle (&nh);
|
__netlink_free_handle (&nh);
|
||||||
|
|
||||||
exit_close:
|
|
||||||
__netlink_close (&nh);
|
__netlink_close (&nh);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1997 Free Software Foundation, Inc.
|
/* Copyright (C) 1997, 2005 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -21,13 +21,83 @@
|
|||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <asm/types.h>
|
|
||||||
|
|
||||||
#include <linux/if_tr.h>
|
/* IEEE 802.5 Token-Ring magic constants. The frame sizes omit the preamble
|
||||||
|
and FCS/CRC (frame check sequence). */
|
||||||
|
#define TR_ALEN 6 /* Octets in one token-ring addr */
|
||||||
|
#define TR_HLEN (sizeof (struct trh_hdr) + sizeof (struct trllc))
|
||||||
|
#define AC 0x10
|
||||||
|
#define LLC_FRAME 0x40
|
||||||
|
|
||||||
|
/* LLC and SNAP constants */
|
||||||
|
#define EXTENDED_SAP 0xAA
|
||||||
|
#define UI_CMD 0x03
|
||||||
|
|
||||||
|
/* This is an Token-Ring frame header. */
|
||||||
|
struct trh_hdr
|
||||||
|
{
|
||||||
|
u_int8_t ac; /* access control field */
|
||||||
|
u_int8_t fc; /* frame control field */
|
||||||
|
u_int8_t daddr[TR_ALEN]; /* destination address */
|
||||||
|
u_int8_t saddr[TR_ALEN]; /* source address */
|
||||||
|
u_int16_t rcf; /* route control field */
|
||||||
|
u_int16_t rseg[8]; /* routing registers */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* This is an Token-Ring LLC structure */
|
||||||
|
struct trllc
|
||||||
|
{
|
||||||
|
u_int8_t dsap; /* destination SAP */
|
||||||
|
u_int8_t ssap; /* source SAP */
|
||||||
|
u_int8_t llc; /* LLC control field */
|
||||||
|
u_int8_t protid[3]; /* protocol id */
|
||||||
|
u_int16_t ethertype; /* ether type field */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Token-Ring statistics collection data. */
|
||||||
|
struct tr_statistics
|
||||||
|
{
|
||||||
|
unsigned long rx_packets; /* total packets received */
|
||||||
|
unsigned long tx_packets; /* total packets transmitted */
|
||||||
|
unsigned long rx_bytes; /* total bytes received */
|
||||||
|
unsigned long tx_bytes; /* total bytes transmitted */
|
||||||
|
unsigned long rx_errors; /* bad packets received */
|
||||||
|
unsigned long tx_errors; /* packet transmit problems */
|
||||||
|
unsigned long rx_dropped; /* no space in linux buffers */
|
||||||
|
unsigned long tx_dropped; /* no space available in linux */
|
||||||
|
unsigned long multicast; /* multicast packets received */
|
||||||
|
unsigned long transmit_collision;
|
||||||
|
|
||||||
|
/* detailed Token-Ring errors. See IBM Token-Ring Network
|
||||||
|
Architecture for more info */
|
||||||
|
|
||||||
|
unsigned long line_errors;
|
||||||
|
unsigned long internal_errors;
|
||||||
|
unsigned long burst_errors;
|
||||||
|
unsigned long A_C_errors;
|
||||||
|
unsigned long abort_delimiters;
|
||||||
|
unsigned long lost_frames;
|
||||||
|
unsigned long recv_congest_count;
|
||||||
|
unsigned long frame_copied_errors;
|
||||||
|
unsigned long frequency_errors;
|
||||||
|
unsigned long token_errors;
|
||||||
|
unsigned long dummy1;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* source routing stuff */
|
||||||
|
#define TR_RII 0x80
|
||||||
|
#define TR_RCF_DIR_BIT 0x80
|
||||||
|
#define TR_RCF_LEN_MASK 0x1f00
|
||||||
|
#define TR_RCF_BROADCAST 0x8000 /* all-routes broadcast */
|
||||||
|
#define TR_RCF_LIMITED_BROADCAST 0xC000 /* single-route broadcast */
|
||||||
|
#define TR_RCF_FRAME2K 0x20
|
||||||
|
#define TR_RCF_BROADCAST_MASK 0xC000
|
||||||
|
#define TR_MAXRIFLEN 18
|
||||||
|
|
||||||
#ifdef __USE_BSD
|
#ifdef __USE_BSD
|
||||||
|
|
||||||
struct trn_hdr {
|
struct trn_hdr
|
||||||
|
{
|
||||||
u_int8_t trn_ac; /* access control field */
|
u_int8_t trn_ac; /* access control field */
|
||||||
u_int8_t trn_fc; /* field control field */
|
u_int8_t trn_fc; /* field control field */
|
||||||
u_int8_t trn_dhost[TR_ALEN]; /* destination host */
|
u_int8_t trn_dhost[TR_ALEN]; /* destination host */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2004 Free Software Foundation, Inc.
|
/* Copyright (C) 2004, 2005 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -55,8 +55,7 @@ extern int __no_netlink_support attribute_hidden;
|
|||||||
extern int __netlink_open (struct netlink_handle *h);
|
extern int __netlink_open (struct netlink_handle *h);
|
||||||
extern void __netlink_close (struct netlink_handle *h);
|
extern void __netlink_close (struct netlink_handle *h);
|
||||||
extern void __netlink_free_handle (struct netlink_handle *h);
|
extern void __netlink_free_handle (struct netlink_handle *h);
|
||||||
extern int __netlink_sendreq (struct netlink_handle *h, int type);
|
extern int __netlink_request (struct netlink_handle *h, int type);
|
||||||
extern int __netlink_receive (struct netlink_handle *h);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* netlinkaccess.h */
|
#endif /* netlinkaccess.h */
|
||||||
|
Loading…
Reference in New Issue
Block a user