Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Achou.Wang
accel-ppp
提交
939ff04f
A
accel-ppp
项目概览
Achou.Wang
/
accel-ppp
通知
6
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
accel-ppp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
939ff04f
编写于
11月 22, 2015
作者:
D
Dmitry Kozlov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
preparation for DPDK intergation (part 2)
上级
bf84f976
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
53 addition
and
52 deletion
+53
-52
accel-pppd/ctrl/pppoe/pppoe.c
accel-pppd/ctrl/pppoe/pppoe.c
+7
-6
accel-pppd/ctrl/pppoe/pppoe.h
accel-pppd/ctrl/pppoe/pppoe.h
+1
-1
accel-pppd/ifcfg.c
accel-pppd/ifcfg.c
+15
-15
accel-pppd/net.c
accel-pppd/net.c
+1
-1
accel-pppd/ppp/ccp_mppe.c
accel-pppd/ppp/ccp_mppe.c
+3
-3
accel-pppd/ppp/lcp_opt_accomp.c
accel-pppd/ppp/lcp_opt_accomp.c
+2
-2
accel-pppd/ppp/lcp_opt_mru.c
accel-pppd/ppp/lcp_opt_mru.c
+1
-1
accel-pppd/ppp/lcp_opt_pcomp.c
accel-pppd/ppp/lcp_opt_pcomp.c
+2
-2
accel-pppd/ppp/ppp.c
accel-pppd/ppp/ppp.c
+10
-10
accel-pppd/ppp/ppp_ccp.c
accel-pppd/ppp/ppp_ccp.c
+2
-2
accel-pppd/ppp/ppp_ifcfg.c
accel-pppd/ppp/ppp_ifcfg.c
+8
-8
accel-pppd/session.c
accel-pppd/session.c
+1
-1
未找到文件。
accel-pppd/ctrl/pppoe/pppoe.c
浏览文件 @
939ff04f
...
...
@@ -411,7 +411,7 @@ static void connect_channel(struct pppoe_conn_t *conn)
triton_event_fire
(
EV_CTRL_STARTING
,
&
conn
->
ppp
.
ses
);
triton_event_fire
(
EV_CTRL_STARTED
,
&
conn
->
ppp
.
ses
);
sock
=
socket
(
AF_PPPOX
,
SOCK_STREAM
,
PX_PROTO_OE
);
sock
=
net
->
pppox_socket
(
PX_PROTO_OE
);
if
(
!
sock
)
{
log_error
(
"pppoe: socket(PPPOX): %s
\n
"
,
strerror
(
errno
));
goto
out_err
;
...
...
@@ -427,7 +427,7 @@ static void connect_channel(struct pppoe_conn_t *conn)
strcpy
(
sp
.
sa_addr
.
pppoe
.
dev
,
conn
->
serv
->
ifname
);
memcpy
(
sp
.
sa_addr
.
pppoe
.
remote
,
conn
->
addr
,
ETH_ALEN
);
if
(
connect
(
sock
,
(
struct
sockaddr
*
)
&
sp
,
sizeof
(
sp
)))
{
if
(
net
->
pppox_
connect
(
sock
,
(
struct
sockaddr
*
)
&
sp
,
sizeof
(
sp
)))
{
log_error
(
"pppoe: connect: %s
\n
"
,
strerror
(
errno
));
goto
out_err_close
;
}
...
...
@@ -1320,6 +1320,7 @@ static void __pppoe_server_start(const char *ifname, const char *opt, void *cli,
struct
pppoe_serv_t
*
serv
;
struct
ifreq
ifr
;
int
padi_limit
=
conf_padi_limit
;
const
struct
ap_net
*
net
=
&
def_net
;
if
(
parse_server
(
opt
,
&
padi_limit
))
{
if
(
cli
)
...
...
@@ -1350,7 +1351,7 @@ static void __pppoe_server_start(const char *ifname, const char *opt, void *cli,
}
strncpy
(
ifr
.
ifr_name
,
ifname
,
sizeof
(
ifr
.
ifr_name
));
if
(
ioctl
(
sock_fd
,
SIOCGIFHWADDR
,
&
ifr
))
{
if
(
net
->
sock_ioctl
(
SIOCGIFHWADDR
,
&
ifr
))
{
if
(
cli
)
cli_sendv
(
cli
,
"ioctl(SIOCGIFHWADDR): %s
\r\n
"
,
strerror
(
errno
));
log_error
(
"pppoe: ioctl(SIOCGIFHWADDR): %s
\n
"
,
strerror
(
errno
));
...
...
@@ -1373,7 +1374,7 @@ static void __pppoe_server_start(const char *ifname, const char *opt, void *cli,
memcpy
(
serv
->
hwaddr
,
ifr
.
ifr_hwaddr
.
sa_data
,
ETH_ALEN
);
if
(
ioctl
(
sock_fd
,
SIOCGIFMTU
,
&
ifr
))
{
if
(
net
->
sock_ioctl
(
SIOCGIFMTU
,
&
ifr
))
{
if
(
cli
)
cli_sendv
(
cli
,
"ioctl(SIOCGIFMTU): %s
\r\n
"
,
strerror
(
errno
));
log_error
(
"pppoe: ioctl(SIOCGIFMTU): %s
\n
"
,
strerror
(
errno
));
...
...
@@ -1386,7 +1387,7 @@ static void __pppoe_server_start(const char *ifname, const char *opt, void *cli,
log_error
(
"pppoe: interface %s has MTU of %i, should be %i
\n
"
,
ifname
,
ifr
.
ifr_mtu
,
ETH_DATA_LEN
);
}
if
(
ioctl
(
sock_fd
,
SIOCGIFINDEX
,
&
ifr
))
{
if
(
net
->
sock_ioctl
(
SIOCGIFINDEX
,
&
ifr
))
{
if
(
cli
)
cli_sendv
(
cli
,
"ioctl(SIOCGIFINDEX): %s
\r\n
"
,
strerror
(
errno
));
log_error
(
"pppoe: ioctl(SIOCGIFINDEX): %s
\n
"
,
strerror
(
errno
));
...
...
@@ -1397,7 +1398,7 @@ static void __pppoe_server_start(const char *ifname, const char *opt, void *cli,
serv
->
ctx
.
before_switch
=
pppoe_serv_ctx_switch
;
serv
->
ifname
=
_strdup
(
ifname
);
serv
->
ifindex
=
ifr
.
ifr_ifindex
;
serv
->
net
=
&
def_
net
;
serv
->
net
=
net
;
pthread_mutex_init
(
&
serv
->
lock
,
NULL
);
INIT_LIST_HEAD
(
&
serv
->
conn_list
);
...
...
accel-pppd/ctrl/pppoe/pppoe.h
浏览文件 @
939ff04f
...
...
@@ -69,7 +69,7 @@ struct pppoe_serv_t
struct
triton_context_t
ctx
;
struct
rb_node
node
;
struct
ap_net
*
net
;
const
struct
ap_net
*
net
;
uint8_t
hwaddr
[
ETH_ALEN
];
char
*
ifname
;
...
...
accel-pppd/ifcfg.c
浏览文件 @
939ff04f
...
...
@@ -101,13 +101,13 @@ void __export ap_session_accounting_started(struct ap_session *ses)
strcpy
(
ifr
.
ifr_name
,
ses
->
ifname
);
if
(
ses
->
ctrl
->
dont_ifcfg
)
{
if
(
ioctl
(
sock_fd
,
SIOCGIFFLAGS
,
&
ifr
))
if
(
net
->
sock_ioctl
(
SIOCGIFFLAGS
,
&
ifr
))
log_ppp_error
(
"failed to get interface flags: %s
\n
"
,
strerror
(
errno
));
if
(
!
(
ifr
.
ifr_flags
&
IFF_UP
))
{
ifr
.
ifr_flags
|=
IFF_UP
;
if
(
ioctl
(
sock_fd
,
SIOCSIFFLAGS
,
&
ifr
))
if
(
net
->
sock_ioctl
(
SIOCSIFFLAGS
,
&
ifr
))
log_ppp_error
(
"failed to set interface flags: %s
\n
"
,
strerror
(
errno
));
}
}
else
{
...
...
@@ -120,7 +120,7 @@ void __export ap_session_accounting_started(struct ap_session *ses)
addr
.
sin_addr
.
s_addr
=
ses
->
ipv4
->
addr
;
memcpy
(
&
ifr
.
ifr_addr
,
&
addr
,
sizeof
(
addr
));
if
(
ioctl
(
sock_fd
,
SIOCSIFADDR
,
&
ifr
))
if
(
net
->
sock_ioctl
(
SIOCSIFADDR
,
&
ifr
))
log_ppp_error
(
"failed to set IPv4 address: %s
\n
"
,
strerror
(
errno
));
/*if (ses->ctrl->type == CTRL_TYPE_IPOE) {
...
...
@@ -143,7 +143,7 @@ void __export ap_session_accounting_started(struct ap_session *ses)
} else*/
{
memcpy
(
&
ifr
.
ifr_dstaddr
,
&
addr
,
sizeof
(
addr
));
if
(
ioctl
(
sock_fd
,
SIOCSIFDSTADDR
,
&
ifr
))
if
(
net
->
sock_ioctl
(
SIOCSIFDSTADDR
,
&
ifr
))
log_ppp_error
(
"failed to set peer IPv4 address: %s
\n
"
,
strerror
(
errno
));
}
}
...
...
@@ -179,12 +179,12 @@ void __export ap_session_accounting_started(struct ap_session *ses)
}
}
if
(
ioctl
(
sock_fd
,
SIOCGIFFLAGS
,
&
ifr
))
if
(
net
->
sock_ioctl
(
SIOCGIFFLAGS
,
&
ifr
))
log_ppp_error
(
"failed to get interface flags: %s
\n
"
,
strerror
(
errno
));
ifr
.
ifr_flags
|=
IFF_UP
;
if
(
ioctl
(
sock_fd
,
SIOCSIFFLAGS
,
&
ifr
))
if
(
net
->
sock_ioctl
(
SIOCSIFFLAGS
,
&
ifr
))
log_ppp_error
(
"failed to set interface flags: %s
\n
"
,
strerror
(
errno
));
if
(
ses
->
ctrl
->
ppp
)
{
...
...
@@ -193,7 +193,7 @@ void __export ap_session_accounting_started(struct ap_session *ses)
np
.
protocol
=
PPP_IP
;
np
.
mode
=
NPMODE_PASS
;
if
(
ioctl
(
ppp
->
unit_fd
,
PPPIOCSNPMODE
,
&
np
))
if
(
net
->
ppp_
ioctl
(
ppp
->
unit_fd
,
PPPIOCSNPMODE
,
&
np
))
log_ppp_error
(
"failed to set NP (IPv4) mode: %s
\n
"
,
strerror
(
errno
));
}
...
...
@@ -201,7 +201,7 @@ void __export ap_session_accounting_started(struct ap_session *ses)
np
.
protocol
=
PPP_IPV6
;
np
.
mode
=
NPMODE_PASS
;
if
(
ioctl
(
ppp
->
unit_fd
,
PPPIOCSNPMODE
,
&
np
))
if
(
net
->
ppp_
ioctl
(
ppp
->
unit_fd
,
PPPIOCSNPMODE
,
&
np
))
log_ppp_error
(
"failed to set NP (IPv6) mode: %s
\n
"
,
strerror
(
errno
));
}
}
...
...
@@ -228,13 +228,13 @@ void __export ap_session_ifdown(struct ap_session *ses)
memset
(
&
ifr
,
0
,
sizeof
(
ifr
));
strcpy
(
ifr
.
ifr_name
,
ses
->
ifname
);
ioctl
(
sock_fd
,
SIOCSIFFLAGS
,
&
ifr
);
net
->
sock_ioctl
(
SIOCSIFFLAGS
,
&
ifr
);
if
(
ses
->
ipv4
)
{
memset
(
&
addr
,
0
,
sizeof
(
addr
));
addr
.
sin_family
=
AF_INET
;
memcpy
(
&
ifr
.
ifr_addr
,
&
addr
,
sizeof
(
addr
));
ioctl
(
sock_fd
,
SIOCSIFADDR
,
&
ifr
);
net
->
sock_ioctl
(
SIOCSIFADDR
,
&
ifr
);
}
if
(
ses
->
ipv6
)
{
...
...
@@ -275,15 +275,15 @@ int __export ap_session_rename(struct ap_session *ses, const char *ifname, int l
memcpy
(
ifr
.
ifr_newname
,
ifname
,
len
);
ifr
.
ifr_newname
[
len
]
=
0
;
r
=
ioctl
(
sock_fd
,
SIOCSIFNAME
,
&
ifr
);
r
=
net
->
sock_ioctl
(
SIOCSIFNAME
,
&
ifr
);
if
(
r
&&
errno
==
EBUSY
)
{
ioctl
(
sock_fd
,
SIOCGIFFLAGS
,
&
ifr
);
net
->
sock_ioctl
(
SIOCGIFFLAGS
,
&
ifr
);
ifr
.
ifr_flags
&=
~
IFF_UP
;
ioctl
(
sock_fd
,
SIOCSIFFLAGS
,
&
ifr
);
net
->
sock_ioctl
(
SIOCSIFFLAGS
,
&
ifr
);
memcpy
(
ifr
.
ifr_newname
,
ifname
,
len
);
ifr
.
ifr_newname
[
len
]
=
0
;
r
=
ioctl
(
sock_fd
,
SIOCSIFNAME
,
&
ifr
);
r
=
net
->
sock_ioctl
(
SIOCSIFNAME
,
&
ifr
);
up
=
1
;
}
...
...
@@ -302,7 +302,7 @@ int __export ap_session_rename(struct ap_session *ses, const char *ifname, int l
if
(
up
)
{
strcpy
(
ifr
.
ifr_name
,
ses
->
ifname
);
ifr
.
ifr_flags
|=
IFF_UP
;
ioctl
(
sock_fd
,
SIOCSIFFLAGS
,
&
ifr
);
net
->
sock_ioctl
(
SIOCSIFFLAGS
,
&
ifr
);
}
return
r
;
...
...
accel-pppd/net.c
浏览文件 @
939ff04f
...
...
@@ -33,7 +33,7 @@ static int def_sock_ioctl(unsigned long request, void *arg)
return
ioctl
(
sock_fd
,
request
,
arg
);
}
const
struct
ap_net
def_net
=
{
__export
const
struct
ap_net
def_net
=
{
.
pppox_socket
=
def_pppox_socket
,
.
pppox_connect
=
def_pppox_connect
,
.
ppp_open
=
def_ppp_open
,
...
...
accel-pppd/ppp/ccp_mppe.c
浏览文件 @
939ff04f
...
...
@@ -115,7 +115,7 @@ static int setup_mppe_key(int fd, int transmit, uint8_t *key)
data
.
length
=
sizeof
(
buf
);
data
.
transmit
=
transmit
;
if
(
ioctl
(
fd
,
PPPIOCSCOMPRESS
,
&
data
))
{
if
(
net
->
ppp_
ioctl
(
fd
,
PPPIOCSCOMPRESS
,
&
data
))
{
log_ppp_warn
(
"mppe: MPPE requested but not supported by kernel
\n
"
);
return
-
1
;
}
...
...
@@ -129,14 +129,14 @@ static int decrease_mtu(struct ppp_t *ppp)
strcpy
(
ifr
.
ifr_name
,
ppp
->
ses
.
ifname
);
if
(
ioctl
(
sock_fd
,
SIOCGIFMTU
,
&
ifr
))
{
if
(
net
->
ppp_
ioctl
(
sock_fd
,
SIOCGIFMTU
,
&
ifr
))
{
log_ppp_error
(
"mppe: failed to get MTU: %s
\n
"
,
strerror
(
errno
));
return
-
1
;
}
ifr
.
ifr_mtu
-=
MPPE_PAD
;
if
(
ioctl
(
sock_fd
,
SIOCSIFMTU
,
&
ifr
))
{
if
(
net
->
ppp_
ioctl
(
sock_fd
,
SIOCSIFMTU
,
&
ifr
))
{
log_ppp_error
(
"mppe: failed to set MTU: %s
\n
"
,
strerror
(
errno
));
return
-
1
;
}
...
...
accel-pppd/ppp/lcp_opt_accomp.c
浏览文件 @
939ff04f
...
...
@@ -112,14 +112,14 @@ static int accomp_recv_conf_ack(struct ppp_lcp_t *lcp, struct lcp_option_t *opt,
struct
accomp_option_t
*
accomp_opt
=
container_of
(
opt
,
typeof
(
*
accomp_opt
),
opt
);
int
flags
;
if
(
ioctl
(
lcp
->
ppp
->
chan_fd
,
PPPIOCGFLAGS
,
&
flags
))
if
(
net
->
ppp_
ioctl
(
lcp
->
ppp
->
chan_fd
,
PPPIOCGFLAGS
,
&
flags
))
goto
err
;
flags
&=
~
SC_COMP_AC
;
if
(
accomp_opt
->
accomp
&
1
)
flags
|=
SC_COMP_AC
;
if
(
ioctl
(
lcp
->
ppp
->
chan_fd
,
PPPIOCSFLAGS
,
&
flags
))
if
(
net
->
ppp_
ioctl
(
lcp
->
ppp
->
chan_fd
,
PPPIOCSFLAGS
,
&
flags
))
goto
err
;
return
0
;
...
...
accel-pppd/ppp/lcp_opt_mru.c
浏览文件 @
939ff04f
...
...
@@ -125,7 +125,7 @@ static int mru_recv_conf_ack(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, ui
{
struct
mru_option_t
*
mru_opt
=
container_of
(
opt
,
typeof
(
*
mru_opt
),
opt
);
if
(
ioctl
(
lcp
->
ppp
->
chan_fd
,
PPPIOCSMRU
,
&
mru_opt
->
mru
)
&&
if
(
net
->
ppp_
ioctl
(
lcp
->
ppp
->
chan_fd
,
PPPIOCSMRU
,
&
mru_opt
->
mru
)
&&
errno
!=
EIO
&&
errno
!=
ENOTTY
)
log_ppp_error
(
"lcp:mru: failed to set channel MRU: %s
\n
"
,
strerror
(
errno
));
...
...
accel-pppd/ppp/lcp_opt_pcomp.c
浏览文件 @
939ff04f
...
...
@@ -112,14 +112,14 @@ static int pcomp_recv_conf_ack(struct ppp_lcp_t *lcp, struct lcp_option_t *opt,
struct
pcomp_option_t
*
pcomp_opt
=
container_of
(
opt
,
typeof
(
*
pcomp_opt
),
opt
);
int
flags
;
if
(
ioctl
(
lcp
->
ppp
->
chan_fd
,
PPPIOCGFLAGS
,
&
flags
))
if
(
net
->
ppp_
ioctl
(
lcp
->
ppp
->
chan_fd
,
PPPIOCGFLAGS
,
&
flags
))
goto
err
;
flags
&=
~
SC_COMP_AC
;
if
(
pcomp_opt
->
pcomp
&
1
)
flags
|=
SC_COMP_AC
;
if
(
ioctl
(
lcp
->
ppp
->
chan_fd
,
PPPIOCSFLAGS
,
&
flags
))
if
(
net
->
ppp_
ioctl
(
lcp
->
ppp
->
chan_fd
,
PPPIOCSFLAGS
,
&
flags
))
goto
err
;
return
0
;
...
...
accel-pppd/ppp/ppp.c
浏览文件 @
939ff04f
...
...
@@ -80,12 +80,12 @@ int __export establish_ppp(struct ppp_t *ppp)
return
-
1
;
/* Open an instance of /dev/ppp and connect the channel to it */
if
(
ioctl
(
ppp
->
fd
,
PPPIOCGCHAN
,
&
ppp
->
chan_idx
)
==
-
1
)
{
if
(
net
->
ppp_
ioctl
(
ppp
->
fd
,
PPPIOCGCHAN
,
&
ppp
->
chan_idx
)
==
-
1
)
{
log_ppp_error
(
"ioctl(PPPIOCGCHAN): %s
\n
"
,
strerror
(
errno
));
return
-
1
;
}
ppp
->
chan_fd
=
open
(
"/dev/ppp"
,
O_RDWR
);
ppp
->
chan_fd
=
net
->
ppp_open
(
);
if
(
ppp
->
chan_fd
<
0
)
{
log_ppp_error
(
"open(chan) /dev/ppp: %s
\n
"
,
strerror
(
errno
));
return
-
1
;
...
...
@@ -98,7 +98,7 @@ int __export establish_ppp(struct ppp_t *ppp)
goto
exit_close_chan
;
}
if
(
ioctl
(
ppp
->
chan_fd
,
PPPIOCATTCHAN
,
&
ppp
->
chan_idx
)
<
0
)
{
if
(
net
->
ppp_
ioctl
(
ppp
->
chan_fd
,
PPPIOCATTCHAN
,
&
ppp
->
chan_idx
)
<
0
)
{
log_ppp_error
(
"ioctl(PPPIOCATTCHAN): %s
\n
"
,
strerror
(
errno
));
goto
exit_close_chan
;
}
...
...
@@ -155,7 +155,7 @@ int __export connect_ppp_channel(struct ppp_t *ppp)
ppp
->
ses
.
unit_idx
=
uc
->
unit_idx
;
mempool_free
(
uc
);
}
else
{
ppp
->
unit_fd
=
open
(
"/dev/ppp"
,
O_RDWR
);
ppp
->
unit_fd
=
net
->
ppp_open
(
);
if
(
ppp
->
unit_fd
<
0
)
{
log_ppp_error
(
"open(unit) /dev/ppp: %s
\n
"
,
strerror
(
errno
));
goto
exit
;
...
...
@@ -163,7 +163,7 @@ int __export connect_ppp_channel(struct ppp_t *ppp)
fcntl
(
ppp
->
unit_fd
,
F_SETFD
,
fcntl
(
ppp
->
unit_fd
,
F_GETFD
)
|
FD_CLOEXEC
);
if
(
ioctl
(
ppp
->
unit_fd
,
PPPIOCNEWUNIT
,
&
ppp
->
ses
.
unit_idx
)
<
0
)
{
if
(
net
->
ppp_
ioctl
(
ppp
->
unit_fd
,
PPPIOCNEWUNIT
,
&
ppp
->
ses
.
unit_idx
)
<
0
)
{
log_ppp_error
(
"ioctl(PPPIOCNEWUNIT): %s
\n
"
,
strerror
(
errno
));
goto
exit_close_unit
;
}
...
...
@@ -174,7 +174,7 @@ int __export connect_ppp_channel(struct ppp_t *ppp)
}
}
if
(
ioctl
(
ppp
->
chan_fd
,
PPPIOCCONNECT
,
&
ppp
->
ses
.
unit_idx
)
<
0
)
{
if
(
net
->
ppp_
ioctl
(
ppp
->
chan_fd
,
PPPIOCCONNECT
,
&
ppp
->
ses
.
unit_idx
)
<
0
)
{
log_ppp_error
(
"ioctl(PPPIOCCONNECT): %s
\n
"
,
strerror
(
errno
));
goto
exit_close_unit
;
}
...
...
@@ -185,17 +185,17 @@ int __export connect_ppp_channel(struct ppp_t *ppp)
ifr
.
ifr_mtu
=
ppp
->
mtu
;
strcpy
(
ifr
.
ifr_name
,
ppp
->
ses
.
ifname
);
if
(
ppp
->
mtu
&&
ioctl
(
sock_fd
,
SIOCSIFMTU
,
&
ifr
))
{
if
(
ppp
->
mtu
&&
net
->
sock_ioctl
(
SIOCSIFMTU
,
&
ifr
))
{
log_ppp_error
(
"failed to set MTU: %s
\n
"
,
strerror
(
errno
));
goto
exit_close_unit
;
}
if
(
ppp
->
mru
&&
ioctl
(
ppp
->
unit_fd
,
PPPIOCSMRU
,
&
ppp
->
mru
))
{
if
(
ppp
->
mru
&&
net
->
ppp_
ioctl
(
ppp
->
unit_fd
,
PPPIOCSMRU
,
&
ppp
->
mru
))
{
log_ppp_error
(
"failed to set MRU: %s
\n
"
,
strerror
(
errno
));
goto
exit_close_unit
;
}
if
(
ioctl
(
sock_fd
,
SIOCGIFINDEX
,
&
ifr
))
{
if
(
net
->
sock_ioctl
(
SIOCGIFINDEX
,
&
ifr
))
{
log_ppp_error
(
"ioctl(SIOCGIFINDEX): %s
\n
"
,
strerror
(
errno
));
goto
exit_close_unit
;
}
...
...
@@ -247,7 +247,7 @@ static void destablish_ppp(struct ppp_t *ppp)
sprintf
(
ifr
.
ifr_newname
,
"ppp%i"
,
ppp
->
ses
.
unit_idx
);
if
(
strcmp
(
ifr
.
ifr_newname
,
ppp
->
ses
.
ifname
))
{
strncpy
(
ifr
.
ifr_name
,
ppp
->
ses
.
ifname
,
IFNAMSIZ
);
if
(
ioctl
(
sock_fd
,
SIOCSIFNAME
,
&
ifr
))
{
if
(
net
->
sock_ioctl
(
SIOCSIFNAME
,
&
ifr
))
{
triton_md_unregister_handler
(
&
ppp
->
unit_hnd
,
1
);
goto
skip
;
}
...
...
accel-pppd/ppp/ppp_ccp.c
浏览文件 @
939ff04f
...
...
@@ -75,7 +75,7 @@ static int ccp_set_flags(int fd, int isopen, int isup)
{
int
flags
;
if
(
ioctl
(
fd
,
PPPIOCGFLAGS
,
&
flags
))
{
if
(
net
->
ppp_
ioctl
(
fd
,
PPPIOCGFLAGS
,
&
flags
))
{
log_ppp_error
(
"ccp: failed to get flags: %s
\n
"
,
strerror
(
errno
));
return
-
1
;
}
...
...
@@ -83,7 +83,7 @@ static int ccp_set_flags(int fd, int isopen, int isup)
flags
&=
~
(
SC_CCP_OPEN
|
SC_CCP_UP
);
flags
|=
(
isopen
?
SC_CCP_OPEN
:
0
)
|
(
isup
?
SC_CCP_UP
:
0
);
if
(
ioctl
(
fd
,
PPPIOCSFLAGS
,
&
flags
))
{
if
(
net
->
ppp_
ioctl
(
fd
,
PPPIOCSFLAGS
,
&
flags
))
{
log_ppp_error
(
"ccp: failed to set flags: %s
\n
"
,
strerror
(
errno
));
return
-
1
;
}
...
...
accel-pppd/ppp/ppp_ifcfg.c
浏览文件 @
939ff04f
...
...
@@ -76,13 +76,13 @@ void ppp_ifup(struct ppp_t *ppp)
addr
.
sin_addr
.
s_addr
=
ppp
->
ses
.
ipv4
->
addr
;
memcpy
(
&
ifr
.
ifr_addr
,
&
addr
,
sizeof
(
addr
));
if
(
ioctl
(
sock_fd
,
SIOCSIFADDR
,
&
ifr
))
if
(
net
->
sock_ioctl
(
SIOCSIFADDR
,
&
ifr
))
log_ppp_error
(
"ppp: failed to set IPv4 address: %s
\n
"
,
strerror
(
errno
));
addr
.
sin_addr
.
s_addr
=
ppp
->
ses
.
ipv4
->
peer_addr
;
memcpy
(
&
ifr
.
ifr_dstaddr
,
&
addr
,
sizeof
(
addr
));
if
(
ioctl
(
sock_fd
,
SIOCSIFDSTADDR
,
&
ifr
))
if
(
net
->
sock_ioctl
(
SIOCSIFDSTADDR
,
&
ifr
))
log_ppp_error
(
"ppp: failed to set peer IPv4 address: %s
\n
"
,
strerror
(
errno
));
}
...
...
@@ -112,19 +112,19 @@ void ppp_ifup(struct ppp_t *ppp)
}
}
if
(
ioctl
(
sock_fd
,
SIOCGIFFLAGS
,
&
ifr
))
if
(
net
->
sock_ioctl
(
SIOCGIFFLAGS
,
&
ifr
))
log_ppp_error
(
"ppp: failed to get interface flags: %s
\n
"
,
strerror
(
errno
));
ifr
.
ifr_flags
|=
IFF_UP
|
IFF_POINTOPOINT
;
if
(
ioctl
(
sock_fd
,
SIOCSIFFLAGS
,
&
ifr
))
if
(
net
->
sock_ioctl
(
SIOCSIFFLAGS
,
&
ifr
))
log_ppp_error
(
"ppp: failed to set interface flags: %s
\n
"
,
strerror
(
errno
));
if
(
ppp
->
ses
.
ipv4
)
{
np
.
protocol
=
PPP_IP
;
np
.
mode
=
NPMODE_PASS
;
if
(
ioctl
(
ppp
->
unit_fd
,
PPPIOCSNPMODE
,
&
np
))
if
(
net
->
ppp_
ioctl
(
ppp
->
unit_fd
,
PPPIOCSNPMODE
,
&
np
))
log_ppp_error
(
"ppp: failed to set NP (IPv4) mode: %s
\n
"
,
strerror
(
errno
));
}
...
...
@@ -132,7 +132,7 @@ void ppp_ifup(struct ppp_t *ppp)
np
.
protocol
=
PPP_IPV6
;
np
.
mode
=
NPMODE_PASS
;
if
(
ioctl
(
ppp
->
unit_fd
,
PPPIOCSNPMODE
,
&
np
))
if
(
net
->
ppp_
ioctl
(
ppp
->
unit_fd
,
PPPIOCSNPMODE
,
&
np
))
log_ppp_error
(
"ppp: failed to set NP (IPv6) mode: %s
\n
"
,
strerror
(
errno
));
}
...
...
@@ -150,13 +150,13 @@ void __export ppp_ifdown(struct ppp_t *ppp)
memset
(
&
ifr
,
0
,
sizeof
(
ifr
));
strcpy
(
ifr
.
ifr_name
,
ppp
->
ifname
);
ioctl
(
sock_fd
,
SIOCSIFFLAGS
,
&
ifr
);
net
->
sock_ioctl
(
SIOCSIFFLAGS
,
&
ifr
);
if
(
ppp
->
ses
.
ipv4
)
{
memset
(
&
addr
,
0
,
sizeof
(
addr
));
addr
.
sin_family
=
AF_INET
;
memcpy
(
&
ifr
.
ifr_addr
,
&
addr
,
sizeof
(
addr
));
ioctl
(
sock_fd
,
SIOCSIFADDR
,
&
ifr
);
net
->
sock_ioctl
(
SIOCSIFADDR
,
&
ifr
);
}
if
(
ppp
->
ses
.
ipv6
)
{
...
...
accel-pppd/session.c
浏览文件 @
939ff04f
...
...
@@ -89,7 +89,7 @@ int __export ap_session_starting(struct ap_session *ses)
memset
(
&
ifr
,
0
,
sizeof
(
ifr
));
strcpy
(
ifr
.
ifr_name
,
ses
->
ifname
);
if
(
ioctl
(
sock_fd
,
SIOCGIFINDEX
,
&
ifr
))
{
if
(
net
->
sock_ioctl
(
SIOCGIFINDEX
,
&
ifr
))
{
log_ppp_error
(
"ioctl(SIOCGIFINDEX): %s
\n
"
,
strerror
(
errno
));
return
-
1
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录