summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-08-25 11:29:24 +0900
committerISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-08-25 11:45:23 +0900
commit1d8c71e22b9c974db66ff41cba81ae601ea14dd7 (patch)
tree25e458da32ddc543352452741119aa295dd9a5f5
parent64ddb52890451da4c9877f8b3273fb9fe35f878c (diff)
*: better log msg
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
-rw-r--r--packet/validate.go8
-rw-r--r--table/destination.go9
-rw-r--r--table/table.go4
3 files changed, 11 insertions, 10 deletions
diff --git a/packet/validate.go b/packet/validate.go
index e82113ee..73697c4d 100644
--- a/packet/validate.go
+++ b/packet/validate.go
@@ -139,7 +139,7 @@ func ValidateAttribute(a PathAttributeInterface, rfs map[RouteFamily]bool, doCon
case *PathAttributeUnknown:
if p.getFlags()&BGP_ATTR_FLAG_OPTIONAL == 0 {
- eMsg := "unrecognized well-known attribute"
+ eMsg := fmt.Sprintf("unrecognized well-known attribute %s", p.GetType())
data, _ := a.Serialize()
return false, NewMessageError(eCode, eSubCodeUnknown, data, eMsg)
}
@@ -156,7 +156,7 @@ func ValidateFlags(t BGPAttrType, flags BGPAttrFlag) (bool, string) {
* RFC 4271 P.17 For well-known attributes, the Transitive bit MUST be set to 1.
*/
if flags&BGP_ATTR_FLAG_OPTIONAL == 0 && flags&BGP_ATTR_FLAG_TRANSITIVE == 0 {
- eMsg := "well-known attribute must have transitive flag 1"
+ eMsg := fmt.Sprintf("well-known attribute %s must have transitive flag 1", t)
return false, eMsg
}
/*
@@ -164,11 +164,11 @@ func ValidateFlags(t BGPAttrType, flags BGPAttrFlag) (bool, string) {
* the Partial bit MUST be set to 0.
*/
if flags&BGP_ATTR_FLAG_OPTIONAL == 0 && flags&BGP_ATTR_FLAG_PARTIAL != 0 {
- eMsg := "well-known attribute must have partial bit 0"
+ eMsg := fmt.Sprintf("well-known attribute %s must have partial bit 0", t)
return false, eMsg
}
if flags&BGP_ATTR_FLAG_OPTIONAL != 0 && flags&BGP_ATTR_FLAG_TRANSITIVE == 0 && flags&BGP_ATTR_FLAG_PARTIAL != 0 {
- eMsg := "optional non-transitive attribute must have partial bit 0"
+ eMsg := fmt.Sprintf("optional non-transitive attribute %s must have partial bit 0", t)
return false, eMsg
}
diff --git a/table/destination.go b/table/destination.go
index 96979a78..290830a4 100644
--- a/table/destination.go
+++ b/table/destination.go
@@ -251,15 +251,16 @@ func (dest *Destination) Calculate() (*Path, string, error) {
//"""
func (dest *Destination) removeWithdrawals() {
+ // If we have no withdrawals, we have nothing to do.
+ if len(dest.withdrawList) == 0 {
+ return
+ }
+
log.WithFields(log.Fields{
"Topic": "Table",
"Key": dest.GetNlri().String(),
"Length": len(dest.withdrawList),
}).Debug("Removing withdrawals")
- // If we have no withdrawals, we have nothing to do.
- if len(dest.withdrawList) == 0 {
- return
- }
// If we have some withdrawals and no know-paths, it means it is safe to
// delete these withdraws.
diff --git a/table/table.go b/table/table.go
index 0d6abd29..d40ac9c4 100644
--- a/table/table.go
+++ b/table/table.go
@@ -182,8 +182,8 @@ func (t *Table) getOrCreateDest(nlri bgp.AddrPrefixInterface) *Destination {
if dest == nil {
log.WithFields(log.Fields{
"Topic": "Table",
- "Key": t.routeFamily,
- }).Debugf("create Destination with key %s", tableKey)
+ "Key": tableKey,
+ }).Debugf("create Destination")
dest = NewDestination(nlri)
t.setDestination(tableKey, dest)
}