Changeset fb288fa in rtems-libbsd


Ignore:
Timestamp:
Jan 11, 2017, 1:15:31 PM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
fd86c091b97759106da7355ce1dd81ebe030e285, f020f08430150c1656a0ad0a1de13699db9b980b
Children:
172f2ac
Parents:
f11bfc2
Message:

ROUTE(8): Disable routing socket timeout support

FIXME: This reverts the following change in FreeBSD.

commit 76a39ff8dc5e1f7bc8a065115ec3837761ed0600
Author: ae <ae@…>
Date: Wed Jul 27 08:26:34 2016 +0000

Due to dropped mbuf in netisr queue route(8) can fall into infinity
loop of reading the rtsock's feed. When it used by some scripts,
this leads to growing number of not finished route(8) instances and
thus growing number of rtsock consumers. Add SIGALRM handler to
prevent this.

Location:
freebsd/sbin/route
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • freebsd/sbin/route/route.c

    rf11bfc2 rfb288fa  
    165165static void usage(const char *) __dead2;
    166166
     167#ifndef __rtems__
    167168#define READ_TIMEOUT    10
    168169static volatile sig_atomic_t stop_read;
     
    174175        stop_read = 1;
    175176}
     177#else /* __rtems__ */
     178#define stop_read 0
     179#endif /* __rtems__ */
    176180
    177181static void
     
    839843newroute(int argc, char **argv)
    840844{
     845#ifndef __rtems__
    841846        struct sigaction sa;
     847#endif /* __rtems__ */
    842848        struct hostent *hp;
    843849        struct fibl *fl;
     
    855861        TAILQ_INIT(&fibl_head);
    856862
     863#ifndef __rtems__
    857864        sigemptyset(&sa.sa_mask);
    858865        sa.sa_flags = 0;
     
    860867        if (sigaction(SIGALRM, &sa, 0) == -1)
    861868                warn("sigaction SIGALRM");
     869#endif /* __rtems__ */
    862870
    863871        cmd = argv[0];
     
    16111619        }
    16121620        if (cmd == RTM_GET) {
     1621#ifndef __rtems__
    16131622                stop_read = 0;
    16141623                alarm(READ_TIMEOUT);
     1624#endif /* __rtems__ */
    16151625                do {
    16161626                        l = read(s, (char *)&m_rtmsg, sizeof(m_rtmsg));
    16171627                } while (l > 0 && stop_read == 0 &&
    16181628                    (rtm.rtm_seq != rtm_seq || rtm.rtm_pid != pid));
     1629#ifndef __rtems__
    16191630                if (stop_read != 0) {
    16201631                        warnx("read from routing socket timed out");
     
    16221633                } else
    16231634                        alarm(0);
     1635#endif /* __rtems__ */
    16241636                if (l < 0)
    16251637                        warn("read from routing socket");
  • freebsd/sbin/route/rtems-bsd-route-route-data.h

    rf11bfc2 rfb288fa  
    2424RTEMS_LINKER_RWSET_CONTENT(bsd_prog_route, static struct m_rtmsg m_rtmsg);
    2525RTEMS_LINKER_RWSET_CONTENT(bsd_prog_route, static struct fibl_head_t fibl_head);
    26 RTEMS_LINKER_RWSET_CONTENT(bsd_prog_route, static sig_atomic_t volatile stop_read);
    2726RTEMS_LINKER_RWSET_CONTENT(bsd_prog_route, static struct sockaddr_storage so[]);
    2827RTEMS_LINKER_RWSET_CONTENT(bsd_prog_route, static char domain[]);
Note: See TracChangeset for help on using the changeset viewer.