diff options
author | Michele Marchetto <michele@cvs.openbsd.org> | 2009-08-06 09:07:50 +0000 |
---|---|---|
committer | Michele Marchetto <michele@cvs.openbsd.org> | 2009-08-06 09:07:50 +0000 |
commit | 7c1408d22756d2f2d504e2b5f34682da72ada74d (patch) | |
tree | 6f0100f0dae9e22c5f06940660ab68c80650e865 /usr.sbin/ldpd | |
parent | f13e47604c780a3861adfb66f249bcd48f9c3f78 (diff) |
ldpd must not add/delete AF_INET routes, it just have to change them
inserting/deleting MPLS infos.
ok claudio@
Diffstat (limited to 'usr.sbin/ldpd')
-rw-r--r-- | usr.sbin/ldpd/kroute.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/usr.sbin/ldpd/kroute.c b/usr.sbin/ldpd/kroute.c index 3298025d8d4..0e8b50be5f1 100644 --- a/usr.sbin/ldpd/kroute.c +++ b/usr.sbin/ldpd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.3 2009/07/13 19:04:26 michele Exp $ */ +/* $OpenBSD: kroute.c,v 1.4 2009/08/06 09:07:49 michele Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -918,6 +918,7 @@ send_rtlabelmsg(int fd, int action, struct kroute *kroute, u_int32_t family) if (kr_state.fib_sync == 0) return (0); + /* Implicit NULL label should be added/remove just one time */ hr_label = ntohl(kroute->local_label) >> MPLS_LABEL_OFFSET; if (hr_label == MPLS_LABEL_IMPLNULL) { if (action == RTM_ADD && flag_implicit_null) @@ -930,18 +931,18 @@ send_rtlabelmsg(int fd, int action, struct kroute *kroute, u_int32_t family) if (family == AF_INET && kroute->remote_label == 0) return (0); - if (family == AF_INET && action == RTM_ADD) - action = RTM_CHANGE; - /* initialize header */ bzero(&hdr, sizeof(hdr)); hdr.rtm_version = RTM_VERSION; - hdr.rtm_type = action; + + /* ldpd must not add/delete AF_INET routes, instead it should just + modify existing ones adding/remove relevant MPLS infos */ + if (family == AF_INET) + hdr.rtm_type = RTM_CHANGE; + else + hdr.rtm_type = action; + hdr.rtm_flags = RTF_UP; -/* if (action == RTM_CHANGE) - hdr.rtm_fmask = RTF_PROTO3|RTF_PROTO2|RTF_PROTO1| - RTF_REJECT|RTF_BLACKHOLE; -*/ hdr.rtm_priority = 0; hdr.rtm_seq = kr_state.rtseq++; /* overflow doesn't matter */ hdr.rtm_msglen = sizeof(hdr); @@ -999,7 +1000,8 @@ send_rtlabelmsg(int fd, int action, struct kroute *kroute, u_int32_t family) iov[iovcnt++].iov_len = sizeof(mask); } - if (kroute->remote_label != 0) { + /* If action is RTM_DELETE we have to get rid of MPLS infos */ + if (kroute->remote_label != 0 && action != RTM_DELETE) { bzero(&label_out, sizeof(label_out)); label_out.smpls_len = sizeof(label_out); label_out.smpls_family = AF_MPLS; @@ -1017,6 +1019,7 @@ send_rtlabelmsg(int fd, int action, struct kroute *kroute, u_int32_t family) hdr.rtm_mpls = MPLS_OP_PUSH; } + retry: if (writev(fd, iov, iovcnt) == -1) { switch (errno) { @@ -1136,7 +1139,6 @@ send_rtmsg(int fd, int action, struct kroute *kroute) iov[iovcnt++].iov_len = sizeof(sa_rl); } - retry: if (writev(fd, iov, iovcnt) == -1) { switch (errno) { |