mbox series

[0/9] inet: Add Missing Gateway Parameter to Host Route Deletion Interfaces

Message ID 20231216082805.2221938-1-gerickson@nuovations.com (mailing list archive)
Headers show
Series inet: Add Missing Gateway Parameter to Host Route Deletion Interfaces | expand

Message

Grant Erickson Dec. 16, 2023, 8:27 a.m. UTC
Routing table manipulation, host routes among them, should be
fundamentally symmetric. The routing table entry parameters used to
add a route should be identical to those used to delete the same
route. Otherwise, an 'ESRCH' error may occur which, at present, are
suppressed due to commit e03a01d3182d ("inet: Fix error handling when
adding/removing routes") that is masking route deletion errors where
this gateway parameter asymmetry is occurring.

This adds a previously-missing gateway address parameter to the
'connman_inet_del_{,ipv6_}host_route' functions. In addition, call
sites to 'connman_inet_del_{,ipv6_}host_route' are updated to pass the
gateway parameter.

In addition, in the process, this refactors 'nameserver_del_routes'
into a second, helper function 'del_nameserver_route' such that host
route deletion is separated from DNS server iteration. This structure
now mirrors that of 'nameserver_add_routes' and 'add_nameserver_route'
since, again, route addition and deletion should be symmetric.

NOTE: This is only the first half of the necessary change. The second
half is revising the actual implementation of
'connman_inet_del_{,ipv6_}host_route' to take advantage of the
newly-added gateway parameter. Implementation notes in each of
'connman_inet_del_{,ipv6_}host_route' have been added toward that end.

Grant Erickson (9):
  service: Refactor 'nameserver_del_routes'.
  service: Add gateway parameter to DNS host route deletion paths.
  inet: Add gateway parameter to 'connman_inet_del_{,ipv6_}host_route'.
  inet: Document 'connman_inet_{add,del}_{,ipv6_}host_route'.
  service: Const-qualify 'add_nameserver_route'.
  service: Add 'DBG' to 'add_nameserver_route'.
  inet: Document '{add,del}_nameserver_route'.
  inet: Document 'nameserver_{add,del}_routes'.
  inet: Document '__connman_service_nameserver_{add,del}_routes'.

 include/inet.h |  17 ++--
 src/connman.h  |   1 +
 src/gateway.c  |  33 +++++---
 src/inet.c     | 184 ++++++++++++++++++++++++++++++++++++++--
 src/service.c  | 225 ++++++++++++++++++++++++++++++++++++++++++++-----
 5 files changed, 419 insertions(+), 41 deletions(-)

Comments

Marcel Holtmann Dec. 16, 2023, 6:47 p.m. UTC | #1
Hi Grant,

> Routing table manipulation, host routes among them, should be
> fundamentally symmetric. The routing table entry parameters used to
> add a route should be identical to those used to delete the same
> route. Otherwise, an 'ESRCH' error may occur which, at present, are
> suppressed due to commit e03a01d3182d ("inet: Fix error handling when
> adding/removing routes") that is masking route deletion errors where
> this gateway parameter asymmetry is occurring.
> 
> This adds a previously-missing gateway address parameter to the
> 'connman_inet_del_{,ipv6_}host_route' functions. In addition, call
> sites to 'connman_inet_del_{,ipv6_}host_route' are updated to pass the
> gateway parameter.
> 
> In addition, in the process, this refactors 'nameserver_del_routes'
> into a second, helper function 'del_nameserver_route' such that host
> route deletion is separated from DNS server iteration. This structure
> now mirrors that of 'nameserver_add_routes' and 'add_nameserver_route'
> since, again, route addition and deletion should be symmetric.
> 
> NOTE: This is only the first half of the necessary change. The second
> half is revising the actual implementation of
> 'connman_inet_del_{,ipv6_}host_route' to take advantage of the
> newly-added gateway parameter. Implementation notes in each of
> 'connman_inet_del_{,ipv6_}host_route' have been added toward that end.
> 
> Grant Erickson (9):
>  service: Refactor 'nameserver_del_routes'.
>  service: Add gateway parameter to DNS host route deletion paths.
>  inet: Add gateway parameter to 'connman_inet_del_{,ipv6_}host_route'.
>  inet: Document 'connman_inet_{add,del}_{,ipv6_}host_route'.
>  service: Const-qualify 'add_nameserver_route'.
>  service: Add 'DBG' to 'add_nameserver_route'.
>  inet: Document '{add,del}_nameserver_route'.
>  inet: Document 'nameserver_{add,del}_routes'.
>  inet: Document '__connman_service_nameserver_{add,del}_routes'.
> 
> include/inet.h |  17 ++--
> src/connman.h  |   1 +
> src/gateway.c  |  33 +++++---
> src/inet.c     | 184 ++++++++++++++++++++++++++++++++++++++--
> src/service.c  | 225 ++++++++++++++++++++++++++++++++++++++++++++-----
> 5 files changed, 419 insertions(+), 41 deletions(-)

all 9 patches have been applied.

Regards

Marcel