diff options
author | Joe Perches <joe@perches.com> | 2007-12-16 16:45:43 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:58:15 -0500 |
commit | f97c1e0c6ebdb606c97b6cb5e837c6110ac5a961 (patch) | |
tree | 2af3da0114614a127099f9ab2ef706f676faa376 /net/ipv4/ip_gre.c | |
parent | 21cf2253ebcf070bc307e0b56d696a2519c75cb4 (diff) |
[IPV4] net/ipv4: Use ipv4_is_<type>
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_gre.c')
-rw-r--r-- | net/ipv4/ip_gre.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 0832f6e028b8..8b81deb8ff1f 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -176,7 +176,8 @@ static struct ip_tunnel * ipgre_tunnel_lookup(__be32 remote, __be32 local, __be3 | |||
176 | } | 176 | } |
177 | for (t = tunnels_l[h1]; t; t = t->next) { | 177 | for (t = tunnels_l[h1]; t; t = t->next) { |
178 | if (local == t->parms.iph.saddr || | 178 | if (local == t->parms.iph.saddr || |
179 | (local == t->parms.iph.daddr && MULTICAST(local))) { | 179 | (local == t->parms.iph.daddr && |
180 | ipv4_is_multicast(local))) { | ||
180 | if (t->parms.i_key == key && (t->dev->flags&IFF_UP)) | 181 | if (t->parms.i_key == key && (t->dev->flags&IFF_UP)) |
181 | return t; | 182 | return t; |
182 | } | 183 | } |
@@ -201,7 +202,7 @@ static struct ip_tunnel **__ipgre_bucket(struct ip_tunnel_parm *parms) | |||
201 | 202 | ||
202 | if (local) | 203 | if (local) |
203 | prio |= 1; | 204 | prio |= 1; |
204 | if (remote && !MULTICAST(remote)) { | 205 | if (remote && !ipv4_is_multicast(remote)) { |
205 | prio |= 2; | 206 | prio |= 2; |
206 | h ^= HASH(remote); | 207 | h ^= HASH(remote); |
207 | } | 208 | } |
@@ -367,7 +368,8 @@ static void ipgre_err(struct sk_buff *skb, u32 info) | |||
367 | 368 | ||
368 | read_lock(&ipgre_lock); | 369 | read_lock(&ipgre_lock); |
369 | t = ipgre_tunnel_lookup(iph->daddr, iph->saddr, (flags&GRE_KEY) ? *(((__be32*)p) + (grehlen>>2) - 1) : 0); | 370 | t = ipgre_tunnel_lookup(iph->daddr, iph->saddr, (flags&GRE_KEY) ? *(((__be32*)p) + (grehlen>>2) - 1) : 0); |
370 | if (t == NULL || t->parms.iph.daddr == 0 || MULTICAST(t->parms.iph.daddr)) | 371 | if (t == NULL || t->parms.iph.daddr == 0 || |
372 | ipv4_is_multicast(t->parms.iph.daddr)) | ||
371 | goto out; | 373 | goto out; |
372 | 374 | ||
373 | if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED) | 375 | if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED) |
@@ -619,7 +621,7 @@ static int ipgre_rcv(struct sk_buff *skb) | |||
619 | skb_postpull_rcsum(skb, skb_transport_header(skb), offset); | 621 | skb_postpull_rcsum(skb, skb_transport_header(skb), offset); |
620 | skb->pkt_type = PACKET_HOST; | 622 | skb->pkt_type = PACKET_HOST; |
621 | #ifdef CONFIG_NET_IPGRE_BROADCAST | 623 | #ifdef CONFIG_NET_IPGRE_BROADCAST |
622 | if (MULTICAST(iph->daddr)) { | 624 | if (ipv4_is_multicast(iph->daddr)) { |
623 | /* Looped back packet, drop it! */ | 625 | /* Looped back packet, drop it! */ |
624 | if (((struct rtable*)skb->dst)->fl.iif == 0) | 626 | if (((struct rtable*)skb->dst)->fl.iif == 0) |
625 | goto drop; | 627 | goto drop; |
@@ -783,7 +785,8 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
783 | struct rt6_info *rt6 = (struct rt6_info*)skb->dst; | 785 | struct rt6_info *rt6 = (struct rt6_info*)skb->dst; |
784 | 786 | ||
785 | if (rt6 && mtu < dst_mtu(skb->dst) && mtu >= IPV6_MIN_MTU) { | 787 | if (rt6 && mtu < dst_mtu(skb->dst) && mtu >= IPV6_MIN_MTU) { |
786 | if ((tunnel->parms.iph.daddr && !MULTICAST(tunnel->parms.iph.daddr)) || | 788 | if ((tunnel->parms.iph.daddr && |
789 | !ipv4_is_multicast(tunnel->parms.iph.daddr)) || | ||
787 | rt6->rt6i_dst.plen == 128) { | 790 | rt6->rt6i_dst.plen == 128) { |
788 | rt6->rt6i_flags |= RTF_MODIFIED; | 791 | rt6->rt6i_flags |= RTF_MODIFIED; |
789 | skb->dst->metrics[RTAX_MTU-1] = mtu; | 792 | skb->dst->metrics[RTAX_MTU-1] = mtu; |
@@ -1009,7 +1012,7 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1009 | 1012 | ||
1010 | t = netdev_priv(dev); | 1013 | t = netdev_priv(dev); |
1011 | 1014 | ||
1012 | if (MULTICAST(p.iph.daddr)) | 1015 | if (ipv4_is_multicast(p.iph.daddr)) |
1013 | nflags = IFF_BROADCAST; | 1016 | nflags = IFF_BROADCAST; |
1014 | else if (p.iph.daddr) | 1017 | else if (p.iph.daddr) |
1015 | nflags = IFF_POINTOPOINT; | 1018 | nflags = IFF_POINTOPOINT; |
@@ -1143,7 +1146,7 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev, | |||
1143 | memcpy(&iph->daddr, daddr, 4); | 1146 | memcpy(&iph->daddr, daddr, 4); |
1144 | return t->hlen; | 1147 | return t->hlen; |
1145 | } | 1148 | } |
1146 | if (iph->daddr && !MULTICAST(iph->daddr)) | 1149 | if (iph->daddr && !ipv4_is_multicast(iph->daddr)) |
1147 | return t->hlen; | 1150 | return t->hlen; |
1148 | 1151 | ||
1149 | return -t->hlen; | 1152 | return -t->hlen; |
@@ -1166,7 +1169,7 @@ static int ipgre_open(struct net_device *dev) | |||
1166 | { | 1169 | { |
1167 | struct ip_tunnel *t = netdev_priv(dev); | 1170 | struct ip_tunnel *t = netdev_priv(dev); |
1168 | 1171 | ||
1169 | if (MULTICAST(t->parms.iph.daddr)) { | 1172 | if (ipv4_is_multicast(t->parms.iph.daddr)) { |
1170 | struct flowi fl = { .oif = t->parms.link, | 1173 | struct flowi fl = { .oif = t->parms.link, |
1171 | .nl_u = { .ip4_u = | 1174 | .nl_u = { .ip4_u = |
1172 | { .daddr = t->parms.iph.daddr, | 1175 | { .daddr = t->parms.iph.daddr, |
@@ -1189,7 +1192,7 @@ static int ipgre_open(struct net_device *dev) | |||
1189 | static int ipgre_close(struct net_device *dev) | 1192 | static int ipgre_close(struct net_device *dev) |
1190 | { | 1193 | { |
1191 | struct ip_tunnel *t = netdev_priv(dev); | 1194 | struct ip_tunnel *t = netdev_priv(dev); |
1192 | if (MULTICAST(t->parms.iph.daddr) && t->mlink) { | 1195 | if (ipv4_is_multicast(t->parms.iph.daddr) && t->mlink) { |
1193 | struct in_device *in_dev = inetdev_by_index(t->mlink); | 1196 | struct in_device *in_dev = inetdev_by_index(t->mlink); |
1194 | if (in_dev) { | 1197 | if (in_dev) { |
1195 | ip_mc_dec_group(in_dev, t->parms.iph.daddr); | 1198 | ip_mc_dec_group(in_dev, t->parms.iph.daddr); |
@@ -1236,7 +1239,7 @@ static int ipgre_tunnel_init(struct net_device *dev) | |||
1236 | 1239 | ||
1237 | if (iph->daddr) { | 1240 | if (iph->daddr) { |
1238 | #ifdef CONFIG_NET_IPGRE_BROADCAST | 1241 | #ifdef CONFIG_NET_IPGRE_BROADCAST |
1239 | if (MULTICAST(iph->daddr)) { | 1242 | if (ipv4_is_multicast(iph->daddr)) { |
1240 | if (!iph->saddr) | 1243 | if (!iph->saddr) |
1241 | return -EINVAL; | 1244 | return -EINVAL; |
1242 | dev->flags = IFF_BROADCAST; | 1245 | dev->flags = IFF_BROADCAST; |