|
@@ -1043,22 +1043,16 @@ void inet_register_protosw(struct inet_protosw *p)
|
|
|
goto out_illegal;
|
|
|
|
|
|
/* If we are trying to override a permanent protocol, bail. */
|
|
|
- answer = NULL;
|
|
|
last_perm = &inetsw[p->type];
|
|
|
list_for_each(lh, &inetsw[p->type]) {
|
|
|
answer = list_entry(lh, struct inet_protosw, list);
|
|
|
-
|
|
|
/* Check only the non-wild match. */
|
|
|
- if (INET_PROTOSW_PERMANENT & answer->flags) {
|
|
|
- if (protocol == answer->protocol)
|
|
|
- break;
|
|
|
- last_perm = lh;
|
|
|
- }
|
|
|
-
|
|
|
- answer = NULL;
|
|
|
+ if ((INET_PROTOSW_PERMANENT & answer->flags) == 0)
|
|
|
+ break;
|
|
|
+ if (protocol == answer->protocol)
|
|
|
+ goto out_permanent;
|
|
|
+ last_perm = lh;
|
|
|
}
|
|
|
- if (answer)
|
|
|
- goto out_permanent;
|
|
|
|
|
|
/* Add the new entry after the last permanent entry if any, so that
|
|
|
* the new entry does not override a permanent entry when matched with
|