Hey,
does anybody use the AddressInfo element with click 2.0 and real device
names, instead of supplying IP addresses directly?
If i use AddressInfo(deviceName wlan0:ip wlan0:eth) for example, i get
the following error: "wlan0:ip" is not a recognizable address.
Either i use AddressInfo in a wrong way, or this is an error. If i use
it wrong, maybe someone could tell me the right way?
It seems, this error is caused by a check within the IPPrefixArg and
IPAddressArg parsers, which check for a non-null ArgContext. When
resolving the ip address of such an interface, there is no underlying
click element, thus the context is null and the ip is never fetched from
the interface. Removing this check seems to fix the problem, but i don't
know, if this can lead to access violations later on. The check should
be there for a good reason.
The attached patch "fixes" this problem by simply removing those checks.
Probably some more work has to be done to make this robust.
Regards,
Sascha Jopen
diff -ru click.git/lib/etheraddress.cc click.patch/lib/etheraddress.cc
--- click.git/lib/etheraddress.cc 2011-08-24 22:52:04.020955615 +0200
+++ click.patch/lib/etheraddress.cc 2011-08-24 23:22:16.578859189 +0200
@@ -122,8 +122,8 @@
return AddressInfo::query_ethernet(str, value.data(), args.context());
#else
(void) args;
-#endif
return false;
+#endif
}
bool
diff -ru click.git/lib/ip6address.cc click.patch/lib/ip6address.cc
--- click.git/lib/ip6address.cc 2011-08-24 22:52:04.021955615 +0200
+++ click.patch/lib/ip6address.cc 2011-08-24 23:24:33.082852591 +0200
@@ -404,12 +404,10 @@
return true;
}
#if !CLICK_TOOL
- if (args.context())
- return AddressInfo::query_ip6(str, result.data(), args.context());
+ return AddressInfo::query_ip6(str, result.data(), args.context());
#else
- (void) args;
-#endif
return false;
+#endif
}
bool
@@ -445,13 +443,11 @@
}
#if !CLICK_TOOL
- if (args.context()
- && AddressInfo::query_ip6_prefix(str, result_addr.data(),
- &result_prefix_len, args.context()))
- return true;
-#endif
-
+ return AddressInfo::query_ip6_prefix(str, result_addr.data(),
+ &result_prefix_len, args.context());
+#else
return false;
+#endif
}
bool
diff -ru click.git/lib/ipaddress.cc click.patch/lib/ipaddress.cc
--- click.git/lib/ipaddress.cc 2011-08-24 22:52:04.021955615 +0200
+++ click.patch/lib/ipaddress.cc 2011-08-24 23:24:51.650851724 +0200
@@ -163,12 +163,11 @@
return true;
}
#if !CLICK_TOOL
- if (args.context())
- return AddressInfo::query_ip(str, result.data(), args.context());
+ return AddressInfo::query_ip(str, result.data(), args.context());
#else
(void) args;
-#endif
return false;
+#endif
}
bool
@@ -248,13 +247,11 @@
}
#if !CLICK_TOOL
- if (args.context()
- && AddressInfo::query_ip_prefix(str, result_addr.data(),
- result_mask.data(), args.context()))
- return true;
-#endif
-
+ return AddressInfo::query_ip_prefix(str, result_addr.data(),
+ result_mask.data(), args.context());
+#else
return false;
+#endif
}
bool
_______________________________________________
click mailing list
[email protected]
https://amsterdam.lcs.mit.edu/mailman/listinfo/click