| 23 | namespace routing { |
| 24 | |
| 25 | Try<Nothing> check() |
| 26 | { |
| 27 | // As advised in libnl, we use numeric values, instead of defined |
| 28 | // macros (which creates compile time dependency), to check |
| 29 | // capabilities. |
| 30 | |
| 31 | // Check NL_CAPABILITY_ROUTE_LINK_VETH_GET_PEER_OWN_REFERENCE. |
| 32 | if (nl_has_capability(2) == 0) { |
| 33 | return Error( |
| 34 | "Capability ROUTE_LINK_VETH_GET_PEER_OWN_REFERENCE is not available"); |
| 35 | } |
| 36 | |
| 37 | // Check NL_CAPABILITY_ROUTE_LINK_CLS_ADD_ACT_OWN_REFERENCE. |
| 38 | if (nl_has_capability(3) == 0) { |
| 39 | return Error( |
| 40 | "Capability ROUTE_LINK_CLS_ADD_ACT_OWN_REFERENCE is not available"); |
| 41 | } |
| 42 | |
| 43 | // There is a bug in libnl3-idiag from duplicating a kernel header |
| 44 | // definition and running certain check logic based on it. The |
| 45 | // kernel header it copies is from 3.6. Older kernels have a |
| 46 | // different definition and therefore return error on certain calls. |
| 47 | // TODO(chzhcn): remove this once the bug in libnl3-idiag is fixed. |
| 48 | if (SK_MEMINFO_VARS == 7) { |
| 49 | return Error( |
| 50 | "libnl3-idiag module has a known bug on kernels older than 3.6"); |
| 51 | } |
| 52 | |
| 53 | return Nothing(); |
| 54 | } |
| 55 | |
| 56 | } // namespace routing { |