Hi James, I did this patch because it seemed simple enough and using the
"onlink" flag was sort of a hack. Could you tell me if you see any
drawbacks?
diff -X /root/diff-no-incluir -uNr iproute-20010824/ip/iproute.c
iproute-20010824-jorge/ip/iproute.c
--- iproute-20010824/ip/iproute.c Tue Dec 17 21:31:58 2002
+++ iproute-20010824-jorge/ip/iproute.c Sat Jan 4 19:27:53 2003
@@ -63,7 +63,7 @@
fprintf(stderr, "TABLE_ID := [ local | main | default | all |
NUMBER ]\n");
fprintf(stderr, "SCOPE := [ host | link | global | NUMBER ]\n");
fprintf(stderr, "FLAGS := [ equalize ]\n");
- fprintf(stderr, "NHFLAGS := [ onlink | pervasive ]\n");
+ fprintf(stderr, "NHFLAGS := [ onlink | pervasive | global ]\n");
fprintf(stderr, "RTPROTO := [ kernel | boot | static | NUMBER ]\n");
exit(-1);
}
@@ -361,6 +368,8 @@
fprintf(fp, "onlink ");
if (r->rtm_flags & RTNH_F_PERVASIVE)
fprintf(fp, "pervasive ");
+ if (r->rtm_flags & RTNH_F_GLOBAL)
+ fprintf(fp, "global ");
if (r->rtm_flags & RTM_F_EQUALIZE)
fprintf(fp, "equalize ");
if (r->rtm_flags & RTM_F_NOTIFY)
@@ -557,6 +566,8 @@
fprintf(fp, " onlink");
if (nh->rtnh_flags & RTNH_F_PERVASIVE)
fprintf(fp, " pervasive");
+ if (nh->rtnh_flags & RTNH_F_GLOBAL)
+ fprintf(fp, " global");
len -= NLMSG_ALIGN(nh->rtnh_len);
nh = RTNH_NEXT(nh);
}
@@ -591,6 +602,8 @@
rtnh->rtnh_hops = w - 1;
} else if (strcmp(*argv, "onlink") == 0) {
rtnh->rtnh_flags |= RTNH_F_ONLINK;
+ } else if (strcmp(*argv, "global") == 0) {
+ rtnh->rtnh_flags |= RTNH_F_GLOBAL;
} else
break;
}
@@ -808,6 +822,8 @@
addattr32(&req.n, sizeof(req), RTA_FLOW, realm);
} else if (strcmp(*argv, "onlink") == 0) {
req.r.rtm_flags |= RTNH_F_ONLINK;
+ } else if (strcmp(*argv, "global") == 0) {
+ req.r.rtm_flags |= RTNH_F_GLOBAL;
} else if (matches(*argv, "equalize") == 0 ||
strcmp(*argv, "eql") == 0) {
req.r.rtm_flags |= RTM_F_EQUALIZE;
diff -X /root/diff-no-incluir -uNr
.../kernel/linux-2.4.20pre11/include/linux/rtnetlink.h
linux-2.4.20pre11-jorge/include/linux/rtnetlink.h
--- ../kernel/linux-2.4.20pre11/include/linux/rtnetlink.h Sat Dec 21
16:02:36 2002
+++ linux-2.4.20pre11-jorge/include/linux/rtnetlink.h Sat Jan 4 19:10:10
2003
@@ -228,6 +230,7 @@
#define RTNH_F_DEAD 1 /* Nexthop is dead (used by multipath) */
#define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */
#define RTNH_F_ONLINK 4 /* Gateway is forced on link */
+#define RTNH_F_GLOBAL 8 /* Gateway is on the Default IP RT */
/* Macros to handle hexthops */
diff -X /root/diff-no-incluir -uNr
../kernel/linux-2.4.20pre11/net/ipv4/fib_semantics.c
linux-2.4.20pre11-jorge/net/ipv4/fib_semantics.c
--- ../kernel/linux-2.4.20pre11/net/ipv4/fib_semantics.c Wed Aug 14 20:24:41
2002
+++ linux-2.4.20pre11-jorge/net/ipv4/fib_semantics.c Sat Jan 4 19:08:40
2003
@@ -375,6 +375,10 @@
memset(&key, 0, sizeof(key));
key.dst = nh->nh_gw;
key.oif = nh->nh_oif;
+ if (nh->nh_flags&RTNH_F_GLOBAL)
+ key.vrf = 0;
+ else
+ key.vrf = vrf;
key.scope = r->rtm_scope + 1;
/* It is not necessary, but requires a bit of thinking */
Best regards,
-Jorge
==============================================================
Jorge Boncompte - Tecnico de sistemas
DTI2 - Desarrollo de la Tecnologia de las Comunicaciones
--------------------------------------------------------------
C/ Abogado Enriquez Barrios, 5 14004 CORDOBA (SPAIN)
Tlf: +34 957 761395 / FAX: +34 957 450380
--------------------------------------------------------------
jo...@dt... _-_-_-_-_-_-_-_-_-_-_-_-_-_ http://www.dti2.net
==============================================================
- Sin pistachos no hay Rock & Roll...
- Without wicker a basket cannot be done.
==============================================================
|