diff -r -U2 iproute-20070313-dsc/include/linux/rtnetlink.h iproute-20070313-dsc-dsad/include/linux/rtnetlink.h --- iproute-20070313-dsc/include/linux/rtnetlink.h 2007-03-13 17:50:56.000000000 -0400 +++ iproute-20070313-dsc-dsad/include/linux/rtnetlink.h 2007-12-06 19:56:50.000000000 -0500 @@ -295,4 +295,5 @@ #define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */ #define RTNH_F_ONLINK 4 /* Gateway is forced on link */ +#define RTNH_F_DSAD 8 /* Dynamic PBR (choose nh by src) */ /* Macros to handle hexthops */ Binary files iproute-20070313-dsc/ip/ip and iproute-20070313-dsc-dsad/ip/ip differ diff -r -U2 iproute-20070313-dsc/ip/iproute.c iproute-20070313-dsc-dsad/ip/iproute.c --- iproute-20070313-dsc/ip/iproute.c 2007-12-07 16:39:48.000000000 -0500 +++ iproute-20070313-dsc-dsad/ip/iproute.c 2007-12-06 19:57:01.000000000 -0500 @@ -70,5 +70,5 @@ fprintf(stderr, " [ mpath MP_ALGO ]\n"); fprintf(stderr, "INFO_SPEC := NH OPTIONS FLAGS [ nexthop NH ]...\n"); - fprintf(stderr, "NH := [ via ADDRESS ] [ dev STRING ] [ weight NUMBER ] NHFLAGS\n"); + fprintf(stderr, "NH := [ via ADDRESS ] [ dev STRING ] [ weight NUMBER | byrealm REALM ] NHFLAGS\n"); fprintf(stderr, "OPTIONS := FLAGS [ mtu NUMBER ] [ advmss NUMBER ]\n"); fprintf(stderr, " [ rtt NUMBER ] [ rttvar NUMBER ]\n"); @@ -583,5 +583,9 @@ } else { fprintf(fp, " dev %s", ll_index_to_name(nh->rtnh_ifindex)); - fprintf(fp, " weight %d", nh->rtnh_hops+1); + if (nh->rtnh_flags & RTNH_F_DSAD) { + fprintf(fp, " byrealm %x", nh->rtnh_hops); + } else { + fprintf(fp, " weight %d", nh->rtnh_hops+1); + } } if (nh->rtnh_flags & RTNH_F_DEAD) @@ -623,4 +627,11 @@ invarg("\"weight\" is invalid\n", *argv); rtnh->rtnh_hops = w - 1; + } else if (strcmp(*argv, "byrealm") == 0) { + unsigned r; + NEXT_ARG(); + if (get_unsigned(&r, *argv, 0) || r == 0 || r > 0x7fff) + invarg("\"byrealm\" is invalid\n", *argv); + rtnh->rtnh_hops = r; + rtnh->rtnh_flags |= RTNH_F_DSAD; } else if (strcmp(*argv, "onlink") == 0) { rtnh->rtnh_flags |= RTNH_F_ONLINK;