OK florian@

On Mon, Nov 30, 2015 at 01:58:16PM +0100, Jeremie Courreges-Anglas wrote:
> 
> Hi,
> 
> get_next_msg() takes an "ifindex" argument, and contains code to check
> whether the interface affected by a routing message is "the correct
> one".  Those tests have always been meaningless since import, 'cause the
> "ifindex" argument passed to this function has always been 0 and the
> checks are never triggered.  The code after the get_next_msg() call
> already properly retrieves and checks the interface index.
> 
> ok to clean up this?
> 
> Index: if.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/rtadvd/if.c,v
> retrieving revision 1.31
> diff -u -p -r1.31 if.c
> --- if.c      30 Nov 2015 12:44:36 -0000      1.31
> +++ if.c      30 Nov 2015 12:50:28 -0000
> @@ -214,13 +214,12 @@ lladdropt_fill(struct sockaddr_dl *sdl, 
>  
>  #define FILTER_MATCH(type, filter) ((0x1 << type) & filter)
>  #define SIN6(s) ((struct sockaddr_in6 *)(s))
> -#define SDL(s) ((struct sockaddr_dl *)(s))
>  char *
> -get_next_msg(char *buf, char *lim, int ifindex, size_t *lenp, int filter)
> +get_next_msg(char *buf, char *lim, size_t *lenp, int filter)
>  {
>       struct rt_msghdr *rtm;
>       struct ifa_msghdr *ifam;
> -     struct sockaddr *sa, *dst, *gw, *ifa, *rti_info[RTAX_MAX];
> +     struct sockaddr *sa, *dst, *ifa, *rti_info[RTAX_MAX];
>  
>       *lenp = 0;
>       for (rtm = (struct rt_msghdr *)buf;
> @@ -255,12 +254,6 @@ get_next_msg(char *buf, char *lim, int i
>                           IN6_IS_ADDR_MULTICAST(&SIN6(dst)->sin6_addr))
>                               continue;
>  
> -                     if ((gw = rti_info[RTAX_GATEWAY]) == NULL ||
> -                         gw->sa_family != AF_INET6)
> -                             continue;
> -                     if (ifindex && SDL(gw)->sdl_index != ifindex)
> -                             continue;
> -
>                       if (rti_info[RTAX_NETMASK] == NULL)
>                               continue;
>  
> @@ -271,8 +264,6 @@ get_next_msg(char *buf, char *lim, int i
>               case RTM_NEWADDR:
>               case RTM_DELADDR:
>                       ifam = (struct ifa_msghdr *)rtm;
> -                     if (ifindex && ifam->ifam_index != ifindex)
> -                             continue;
>  
>                       /* address related checks */
>                       sa = (struct sockaddr *)((char *)rtm + rtm->rtm_hdrlen);
> Index: if.h
> ===================================================================
> RCS file: /cvs/src/usr.sbin/rtadvd/if.h,v
> retrieving revision 1.9
> diff -u -p -r1.9 if.h
> --- if.h      21 May 2010 13:41:23 -0000      1.9
> +++ if.h      30 Nov 2015 12:50:28 -0000
> @@ -42,7 +42,7 @@ int if_getmtu(char *);
>  int if_getflags(int, int);
>  int lladdropt_length(struct sockaddr_dl *);
>  void lladdropt_fill(struct sockaddr_dl *, struct nd_opt_hdr *);
> -char *get_next_msg(char *, char *, int, size_t *, int);
> +char *get_next_msg(char *, char *, size_t *, int);
>  struct in6_addr *get_addr(char *);
>  int get_rtm_ifindex(char *);
>  int get_ifm_ifindex(char *);
> Index: rtadvd.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/rtadvd/rtadvd.c,v
> retrieving revision 1.58
> diff -u -p -r1.58 rtadvd.c
> --- rtadvd.c  25 Oct 2015 22:11:34 -0000      1.58
> +++ rtadvd.c  30 Nov 2015 12:50:28 -0000
> @@ -361,7 +361,7 @@ rtmsg_input(void)
>       for (next = msg; next < lim; next += len) {
>               int oldifflags;
>  
> -             next = get_next_msg(next, lim, 0, &len,
> +             next = get_next_msg(next, lim, &len,
>                                   RTADV_TYPE2BITMASK(RTM_ADD) |
>                                   RTADV_TYPE2BITMASK(RTM_DELETE) |
>                                   RTADV_TYPE2BITMASK(RTM_NEWADDR) |
> 
> 
> -- 
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
> 

-- 
I'm not entirely sure you are real.

Reply via email to