Re: [PATCH net] ipv6: do not overwrite inetpeer metrics prematurely

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 11, 2014 at 04:08:14PM +0100, Michal Kubecek wrote:
> +static int fib6_commit_metrics(struct dst_entry *old_dst, struct dst_entry *dst,
> +			       struct nlattr *mx, int mx_len)
> +{
> +	struct nlattr *nla;
> +	int remaining;
> +	u32 *mp;
> +
> +	/* no new metrics and not inheriting an inetpeer with old ones */
> +	if (!mx && (!(dst->flags & DST_HOST) || !old_dst ||
> +		    dst_metrics_read_only(old_dst)))
> +		return 0;
> +
> +	mp = dst_metrics_write_ptr(dst);
> +	if ((dst->flags & DST_HOST) &&
> +	    old_dst && !dst_metrics_read_only(old_dst))
> +		memset(mp, 0, RTAX_MAX * sizeof(u32));
> +

Small question:

Wouldn't make it easier if we move the kzalloc/dst_init_metrics part to
here in case we aren't a DST_HOST and remove it from ip6_route_add, too?

Otherwise (but really just a first look!), it seems ok to me.

Thanks,

  Hannes

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Discussion]     [TCP Instrumentation]     [Ethernet Bridging]     [Linux Wireless Networking]     [Linux WPAN Networking]     [Linux Host AP]     [Linux WPAN Networking]     [Linux Bluetooth Networking]     [Linux ATH6KL Networking]     [Linux Networking Users]     [Linux Coverity]     [VLAN]     [Git]     [IETF Annouce]     [Linux Assembly]     [Security]     [Bugtraq]     [Yosemite Information]     [MIPS Linux]     [ARM Linux Kernel]     [ARM Linux]     [Linux Virtualization]     [Linux IDE]     [Linux RAID]     [Linux SCSI]