* compare two secindex structure exactly. * IN: * spidx0: source, it is often in SPD. * spidx1: object, it is often from PFKEY message. * OUT: * 1 : equal * 0 : not equal */
| 4167 | * 0 : not equal |
| 4168 | */ |
| 4169 | static int |
| 4170 | key_cmpspidx_exactly(struct secpolicyindex *spidx0, |
| 4171 | struct secpolicyindex *spidx1) |
| 4172 | { |
| 4173 | /* sanity */ |
| 4174 | if (spidx0 == NULL && spidx1 == NULL) |
| 4175 | return 1; |
| 4176 | |
| 4177 | if (spidx0 == NULL || spidx1 == NULL) |
| 4178 | return 0; |
| 4179 | |
| 4180 | if (spidx0->prefs != spidx1->prefs |
| 4181 | || spidx0->prefd != spidx1->prefd |
| 4182 | || spidx0->ul_proto != spidx1->ul_proto |
| 4183 | || spidx0->dir != spidx1->dir) |
| 4184 | return 0; |
| 4185 | |
| 4186 | return key_sockaddrcmp(&spidx0->src.sa, &spidx1->src.sa, 1) == 0 && |
| 4187 | key_sockaddrcmp(&spidx0->dst.sa, &spidx1->dst.sa, 1) == 0; |
| 4188 | } |
| 4189 | |
| 4190 | /* |
| 4191 | * compare two secindex structure with mask. |
no test coverage detected