source: npl/internetserver/iproute2/iproute2-2.6.29.1-flush.patch @ a384a97

perl-5.22
Last change on this file since a384a97 was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100644
File size: 6.1 KB
  • iproute2-2.6.29-1

    diff -Nru iproute2-2.6.29-1.orig/ip/ipaddress.c iproute2-2.6.29-1/ip/ipaddress.c
    old new  
    3737
    3838#define MAX_ROUNDS 10
    3939
     40static struct rtnl_handle rth_flush = { .fd = -1 };
     41
    4042static struct
    4143{
    4244        int ifindex;
     
    339341
    340342static int flush_update(void)
    341343{
    342         if (rtnl_send_check(&rth, filter.flushb, filter.flushp) < 0) {
     344        if (rtnl_send_check(&rth_flush, filter.flushb, filter.flushp) < 0) {
    343345                perror("Failed to send flush request");
    344346                return -1;
    345347        }
     
    697699                filter.flushp = 0;
    698700                filter.flushe = sizeof(flushb);
    699701
     702                if (rtnl_open(&rth_flush, 0) < 0)
     703                        return 1;
     704
    700705                while (round < MAX_ROUNDS) {
    701706                        if (rtnl_wilddump_request(&rth, filter.family, RTM_GETADDR) < 0) {
    702707                                perror("Cannot send dump request");
     
    715720                                                printf("*** Flush is complete after %d round%s ***\n", round, round>1?"s":"");
    716721                                }
    717722                                fflush(stdout);
     723                                rtnl_close(&rth_flush);
    718724                                return 0;
    719725                        }
    720726                        round++;
    721727                        if (flush_update() < 0)
    722                                 return 1;
     728                                break;
    723729
    724730                        if (show_stats) {
    725731                                printf("\n*** Round %d, deleting %d addresses ***\n", round, filter.flushed);
    726732                                fflush(stdout);
    727733                        }
    728734                }
    729                 fprintf(stderr, "*** Flush remains incomplete after %d rounds. ***\n", MAX_ROUNDS); fflush(stderr);
     735                fprintf(stderr, "*** Flush remains incomplete after %d rounds. ***\n", round); fflush(stderr);
     736                rtnl_close(&rth_flush);
    730737                return 1;
    731738        }
    732739
  • iproute2-2.6.29-1

    diff -Nru iproute2-2.6.29-1.orig/ip/ipneigh.c iproute2-2.6.29-1/ip/ipneigh.c
    old new  
    3232#define NUD_VALID       (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY)
    3333#define MAX_ROUNDS      10
    3434
     35static struct rtnl_handle rth_flush = { .fd = -1 };
     36
    3537static struct
    3638{
    3739        int family;
     
    8789
    8890static int flush_update(void)
    8991{
    90         if (rtnl_send_check(&rth, filter.flushb, filter.flushp) < 0) {
     92        if (rtnl_send_check(&rth_flush, filter.flushb, filter.flushp) < 0) {
    9193                perror("Failed to send flush request");
    9294                return -1;
    9395        }
     
    391393                filter.flushe = sizeof(flushb);
    392394                filter.state &= ~NUD_FAILED;
    393395
     396                if (rtnl_open(&rth_flush, 0) < 0)
     397                        return 1;
     398
    394399                while (round < MAX_ROUNDS) {
    395400                        if (rtnl_wilddump_request(&rth, filter.family, RTM_GETNEIGH) < 0) {
    396401                                perror("Cannot send dump request");
     
    409414                                                printf("*** Flush is complete after %d round%s ***\n", round, round>1?"s":"");
    410415                                }
    411416                                fflush(stdout);
     417                                rtnl_close(&rth_flush);
    412418                                return 0;
    413419                        }
    414420                        round++;
    415421                        if (flush_update() < 0)
    416                                 exit(1);
     422                                break;
     423
    417424                        if (show_stats) {
    418425                                printf("\n*** Round %d, deleting %d entries ***\n", round, filter.flushed);
    419426                                fflush(stdout);
    420427                        }
    421428                }
    422                 printf("*** Flush not complete bailing out after %d rounds\n",
    423                         MAX_ROUNDS);
     429                fprintf(stderr, "*** Flush remains incomplete after %d rounds. ***\n", round); fflush(stderr);
     430                rtnl_close(&rth_flush);
    424431                return 1;
    425432        }
    426433
  • iproute2-2.6.29-1

    diff -Nru iproute2-2.6.29-1.orig/ip/iproute.c iproute2-2.6.29-1/ip/iproute.c
    old new  
    3737#define RTAX_RTTVAR RTAX_HOPS
    3838#endif
    3939
     40static struct rtnl_handle rth_flush = { .fd = -1 };
    4041
    4142static const char *mx_names[RTAX_MAX+1] = {
    4243        [RTAX_MTU]      = "mtu",
     
    112113
    113114static int flush_update(void)
    114115{
    115         if (rtnl_send_check(&rth, filter.flushb, filter.flushp) < 0) {
     116        if (rtnl_send_check(&rth_flush, filter.flushb, filter.flushp) < 0) {
    116117                perror("Failed to send flush request");
    117118                return -1;
    118119        }
     
    12101211                filter.flushp = 0;
    12111212                filter.flushe = sizeof(flushb);
    12121213
     1214                if (rtnl_open(&rth_flush, 0) < 0)
     1215                        return 1;
     1216
    12131217                for (;;) {
    12141218                        if (rtnl_wilddump_request(&rth, do_ipv6, RTM_GETROUTE) < 0) {
    12151219                                perror("Cannot send dump request");
     
    12281232                                                printf("*** Flush is complete after %d round%s ***\n", round, round>1?"s":"");
    12291233                                }
    12301234                                fflush(stdout);
     1235                                rtnl_close(&rth_flush);
    12311236                                return 0;
    12321237                        }
    12331238                        round++;
  • ip/xfrm_policy.c

    diff -Nru iproute2-2.6.29-1.orig/ip/xfrm_policy.c iproute2-2.6.29-1/ip/xfrm_policy.c
    old new  
    756756                struct xfrm_buffer xb;
    757757                char buf[NLMSG_DELETEALL_BUF_SIZE];
    758758                int i;
     759                struct rtnl_handle rth2;
    759760
    760761                xb.buf = buf;
    761762                xb.size = sizeof(buf);
    762763                xb.rth = &rth;
    763764
     765                if (rtnl_open(&rth2, 0) < 0)
     766                        exit(1);
     767
    764768                for (i = 0; ; i++) {
    765769                        xb.offset = 0;
    766770                        xb.nlmsg_count = 0;
     
    783787                                break;
    784788                        }
    785789
    786                         if (rtnl_send_check(&rth, xb.buf, xb.offset) < 0) {
     790                        if (rtnl_send_check(&rth2, xb.buf, xb.offset) < 0) {
    787791                                perror("Failed to send delete-all request");
    788792                                exit(1);
    789793                        }
     
    793797                        xb.offset = 0;
    794798                        xb.nlmsg_count = 0;
    795799                }
     800
     801                rtnl_close(&rth2);
    796802        } else {
    797803                if (rtnl_wilddump_request(&rth, preferred_family, XFRM_MSG_GETPOLICY) < 0) {
    798804                        perror("Cannot send dump request");
  • iproute2-2.6.29-1

    diff -Nru iproute2-2.6.29-1.orig/ip/xfrm_state.c iproute2-2.6.29-1/ip/xfrm_state.c
    old new  
    924924                struct xfrm_buffer xb;
    925925                char buf[NLMSG_DELETEALL_BUF_SIZE];
    926926                int i;
     927                struct rtnl_handle rth2;
    927928
    928929                xb.buf = buf;
    929930                xb.size = sizeof(buf);
    930931                xb.rth = &rth;
    931932
     933                if (rtnl_open(&rth2, 0) < 0)
     934                        exit(1);
     935
    932936                for (i = 0; ; i++) {
    933937                        xb.offset = 0;
    934938                        xb.nlmsg_count = 0;
     
    951955                                break;
    952956                        }
    953957
    954                         if (rtnl_send_check(&rth, xb.buf, xb.offset) < 0) {
     958                        if (rtnl_send_check(&rth2, xb.buf, xb.offset) < 0) {
    955959                                perror("Failed to send delete-all request\n");
    956960                                exit(1);
    957961                        }
     
    962966                        xb.nlmsg_count = 0;
    963967                }
    964968
     969                rtnl_close(&rth2);
    965970        } else {
    966971                if (rtnl_wilddump_request(&rth, preferred_family, XFRM_MSG_GETSA) < 0) {
    967972                        perror("Cannot send dump request");
Note: See TracBrowser for help on using the repository browser.