Deleted Added
full compact
arp.c (205272) arp.c (246143)
1/*
2 * sys-bsd.c - System-dependent procedures for setting up
3 * PPP interfaces on bsd-4.4-ish systems (including 386BSD, NetBSD, etc.)
4 *
5 * Copyright (c) 1989 Carnegie Mellon University.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by Carnegie Mellon University. The name of the
14 * University may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
1/*
2 * sys-bsd.c - System-dependent procedures for setting up
3 * PPP interfaces on bsd-4.4-ish systems (including 386BSD, NetBSD, etc.)
4 *
5 * Copyright (c) 1989 Carnegie Mellon University.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by Carnegie Mellon University. The name of the
14 * University may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
20 * $FreeBSD: head/usr.sbin/ppp/arp.c 205272 2010-03-18 00:23:39Z qingli $
20 * $FreeBSD: head/usr.sbin/ppp/arp.c 246143 2013-01-31 08:55:21Z glebius $
21 *
22 */
23
24/*
25 * TODO:
26 */
27
28#include <sys/param.h>

--- 57 unchanged lines hidden (view full) ---

86
87#if RTM_VERSION >= 3
88
89/*
90 * arp_SetProxy - Make a proxy ARP entry for the peer.
91 */
92static struct {
93 struct rt_msghdr hdr;
21 *
22 */
23
24/*
25 * TODO:
26 */
27
28#include <sys/param.h>

--- 57 unchanged lines hidden (view full) ---

86
87#if RTM_VERSION >= 3
88
89/*
90 * arp_SetProxy - Make a proxy ARP entry for the peer.
91 */
92static struct {
93 struct rt_msghdr hdr;
94 struct sockaddr_inarp dst;
94 struct sockaddr_in dst;
95 struct sockaddr_dl hwa;
96 char extra[128];
97} arpmsg;
98
99static int
100arp_ProxySub(struct bundle *bundle, struct in_addr addr, int add)
101{
102 int routes;

--- 16 unchanged lines hidden (view full) ---

119 return 0;
120 }
121 arpmsg.hdr.rtm_type = add ? RTM_ADD : RTM_DELETE;
122 arpmsg.hdr.rtm_flags = RTF_ANNOUNCE | RTF_HOST | RTF_STATIC | RTF_LLDATA;
123 arpmsg.hdr.rtm_version = RTM_VERSION;
124 arpmsg.hdr.rtm_seq = ++bundle->routing_seq;
125 arpmsg.hdr.rtm_addrs = RTA_DST | RTA_GATEWAY;
126 arpmsg.hdr.rtm_inits = RTV_EXPIRE;
95 struct sockaddr_dl hwa;
96 char extra[128];
97} arpmsg;
98
99static int
100arp_ProxySub(struct bundle *bundle, struct in_addr addr, int add)
101{
102 int routes;

--- 16 unchanged lines hidden (view full) ---

119 return 0;
120 }
121 arpmsg.hdr.rtm_type = add ? RTM_ADD : RTM_DELETE;
122 arpmsg.hdr.rtm_flags = RTF_ANNOUNCE | RTF_HOST | RTF_STATIC | RTF_LLDATA;
123 arpmsg.hdr.rtm_version = RTM_VERSION;
124 arpmsg.hdr.rtm_seq = ++bundle->routing_seq;
125 arpmsg.hdr.rtm_addrs = RTA_DST | RTA_GATEWAY;
126 arpmsg.hdr.rtm_inits = RTV_EXPIRE;
127 arpmsg.dst.sin_len = sizeof(struct sockaddr_inarp);
127 arpmsg.dst.sin_len = sizeof(struct sockaddr_in);
128 arpmsg.dst.sin_family = AF_INET;
129 arpmsg.dst.sin_addr.s_addr = addr.s_addr;
128 arpmsg.dst.sin_family = AF_INET;
129 arpmsg.dst.sin_addr.s_addr = addr.s_addr;
130 arpmsg.dst.sin_other = SIN_PROXY;
131
132 arpmsg.hdr.rtm_msglen = (char *) &arpmsg.hwa - (char *) &arpmsg
133 + arpmsg.hwa.sdl_len;
134
135
136 if (ID0write(routes, &arpmsg, arpmsg.hdr.rtm_msglen) < 0 &&
137 !(!add && errno == ESRCH)) {
138 log_Printf(LogERROR, "%s proxy arp entry %s: %s\n",

--- 179 unchanged lines hidden ---
130
131 arpmsg.hdr.rtm_msglen = (char *) &arpmsg.hwa - (char *) &arpmsg
132 + arpmsg.hwa.sdl_len;
133
134
135 if (ID0write(routes, &arpmsg, arpmsg.hdr.rtm_msglen) < 0 &&
136 !(!add && errno == ESRCH)) {
137 log_Printf(LogERROR, "%s proxy arp entry %s: %s\n",

--- 179 unchanged lines hidden ---